Skip to content

Commit

Permalink
Add a shell script for using codee commands; minor correction in sub_…
Browse files Browse the repository at this point in the history
…wrf_pm_testcase.sh
  • Loading branch information
wyang0 authored and namo626 committed Aug 11, 2024
1 parent 7f02a44 commit 0fdc634
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 1 deletion.
121 changes: 121 additions & 0 deletions runcodee
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash
date

ml cpu
#ml use /global/common/software/m4232/modulefiles_test/pm
ml codee
ml -t

RPWD=$(realpath $PWD) # if not in HOME, can use RPWD=$PWD

# (1) All

#codee screening --config compile_commands.json \
# --exclude ${RPWD}/phys/module_sf_noahmplsm.f90 \
# --exclude ${RPWD}/phys/module_shcu_deng.f90 \
# --exclude ${RPWD}/phys/module_cu_kf.f90 \
# --verbose

# (2) show failures

#codee screening --show-failures=all \
# --config compile_commands.json \
# --exclude ${RPWD}/phys/module_sf_noahmplsm.f90 \
# --exclude ${RPWD}/phys/module_shcu_deng.f90 \
# --exclude ${RPWD}/phys/module_cu_kf.f90 \
# --verbose

# (3) Screening report of the entire phys directory

#codee screening --config compile_commands.json \
## --brief ${RPWD}/phys/ \
## --exclude ${RPWD}/phys/module_sf_noahmplsm.f90 \
## --exclude ${RPWD}/phys/module_shcu_deng.f90 \
## --exclude ${RPWD}/phys/module_cu_kf.f90 \
## --verbose
#codee screening --config compile_commands.json --brief ${RPWD}/phys/ \
# --exclude ${RPWD}/phys/module_sf_noahmplsm.f90 \
# --exclude ${RPWD}/phys/module_shcu_deng.f90 \
# --exclude ${RPWD}/phys/module_cu_kf.f90

#

#codee screening --config compile_commands.json \
## --exclude ${RPWD}/phys/module_sf_noahmplsm.f90 \
## --exclude ${RPWD}/phys/module_shcu_deng.f90 \
## --exclude ${RPWD}/phys/module_cu_kf.f90 \
## --verbose

# (4) screeing report of Thompson

#codee screening --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90

#codee screening --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90 --target-arch gpu

# Checks report of Thompson (add --verbose to see more detals)

#codee checks --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90

#codee checks --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90 --target-arch gpu

# Codee diagnose report of Thompson

#codee diagnose --summary \
# --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90

#codee diagnose --summary \
# --config compile_commands.json \
# --brief ${RPWD}/phys/module_mp_thompson.f90 --target-arch gpu

# (5) Focus on a single function, e.g., Kernals_KS

#codee screening --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:Kernals_KS --target-arch gpu

# (6) Check the lines

#codee checks --verbose \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:Kernals_KS --target-arch gpu

# (7) Apply fix with codee: loop interchange

#codee rewrite --memory loop-interchange --in-place \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:6225:3

# (8) Check again with the modified file:

codee checks --verbose \
--config compile_commands.json \
${RPWD}/phys/module_mp_fast_sbm.f90:Kernals_KS --target-arch gpu

# (8) Apply the fix with codee: OpenMP offloading

#codee rewrite --offload omp-teams --in-place \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:6293:4
#codee rewrite --offload omp-teams --in-place \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:6225:3,6236:4,6263:4,6291:4,6379:7

# (9) Check again with the modified file:

#codee checks --verbose \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:Kernals_KS --target-arch gpu

# (9) Apply fix with codee: OpenMP offloading

#codee rewrite --offload omp-teams --in-place \
# --config compile_commands.json \
# ${RPWD}/phys/module_mp_fast_sbm.f90:6238:4,6265:4,6392:7

#codee rewrite --help

date
2 changes: 1 addition & 1 deletion testcases/conus_12-km/sub_wrf_pm_testcase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ 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
# 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
# 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

0 comments on commit 0fdc634

Please sign in to comment.