Skip to content

Commit

Permalink
Add a wrapper script for using Nsight Compute
Browse files Browse the repository at this point in the history
  • Loading branch information
wyang0 authored and namo626 committed Aug 11, 2024
1 parent 66f0e79 commit 7f02a44
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions testcases/conus_12-km/setup_rundir_WRF.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ cp ${scriptdir}/namelist_v4.5.2_conus12km_restart.input ${rundir}/namelist.input
#copy sbatch script
cp ${scriptdir}/sub_wrf_pm_testcase.sh ${rundir}/sub_testcase.sh
cp ${scriptdir}/updown.sh ${rundir}/updown.sh
cp ${scriptdir}/wrapper-ncu.sh ${rundir}/wrapper-ncu.sh

#edit the email address and job name in the sbatch script
sed -i "s/elvis@nersc.gov/${myemail}/" sub_testcase.sh
Expand Down
4 changes: 3 additions & 1 deletion testcases/conus_12-km/sub_wrf_pm_testcase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ if [[ $use_gpu -eq 0 ]]; then
srun -n $n -c $c --cpu-bind=cores /global/common/software/m4232/pm/v4.5.2/wrf.exe
else
(( c = (64 / (n / SLURM_JOB_NUM_NODES)) * 2 ))
srun -n $n -c $c --cpu-bind=cores --gpus-per-task=1 -gpu-bind=none /global/common/software/m4232/pm/v4.5.2/wrf.exe
srun -n $n -c $c --cpu-bind=cores --gpus-per-task=1 --gpu-bind=none /global/common/software/m4232/pm/v4.5.2/wrf.exe
# Profile with Nsight Compute:
srun -n $n -c $c --cpu_bind=cores --gpus-per-task=1 --gpu-bind=none ./wrapper-ncu.sh /global/common/software/m4232/pm/v4.5.2/wrf.exe
fi

#capture error code
Expand Down
10 changes: 10 additions & 0 deletions testcases/conus_12-km/wrapper-ncu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
output=report.%q{SLURM_PROCID}.%q{SLURM_JOBID}

if [[ ${SLURM_PROCID} == "0" ]] ; then
dcgmi profile --pause
ncu --target-processes all --kernel-id :::1 -o ${output} "$@"
dcgmi profile --resume
else
"$@"
fi

0 comments on commit 7f02a44

Please sign in to comment.