-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile_nvprof.sh
More file actions
executable file
·39 lines (31 loc) · 1 KB
/
Copy pathprofile_nvprof.sh
File metadata and controls
executable file
·39 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
BIN=./parallelHistogram
if [ "$#" -gt 0 ] && { [ "$1" = "-h" ] || [ "$1" = "--help" ]; }; then
cat <<EOF
Usage: $0 [OPTIONS]
Profile parallel histogram with nvprof.
Options (passed to parallelHistogram):
--mode MODE Kernel: naive|privatized|aggregated|coarsened|all (default: all)
--n N Number of input elements (default: 1048576)
--bins BINS Number of histogram bins (default: 256)
--threads T Threads per block (default: 256)
--coarse C Coarsening factor (default: 4)
Examples:
$0 --mode naive --n 10000000
$0 --mode privatized --bins 512
$0 --mode all --n 5000000
Output:
Creates nvprof_parallelHistogram_TIMESTAMP.log with GPU trace
EOF
exit 0
fi
if [ ! -x "$BIN" ]; then
echo "Building parallelHistogram..."
make
fi
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
OUTFILE="nvprof_parallelHistogram_${TIMESTAMP}.log"
nvprof --print-gpu-trace --log-file "$OUTFILE" "$BIN" "$@"
echo "Profile saved to: $OUTFILE"