-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts for evaluating code performance #57
Draft
odiazib
wants to merge
19
commits into
main
Choose a base branch
from
oscar/wall_times
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
2de2c8d
RHS and Jacobian test for wall time measurements.
odiazib 37c5136
Add routine to modify the number of particles from AMD. Use this new …
odiazib 52d2588
Scripts for wall times.
odiazib 9f65694
Add machine file template.
odiazib 89e4c54
script to build/install/clone kokkostools
odiazib 2004c24
Move to script folder.
odiazib b91c0c7
Remove files.
odiazib a1b68f7
Fixing paths
odiazib 8c69f25
Missing scripts
odiazib 79e1ed0
Fixing file names.
odiazib 80f14a5
Using ThreadVectorRange and removing team_barrier.
odiazib 71e2b00
Writing outputs only if verbose is true.
odiazib 3b1fd03
Turn off writing output files for numerical experiments.
odiazib 91deed0
write-time-profiles as command input
odiazib 7032aaf
Fixing compilation error.
odiazib 28d29bb
Fixing typo.
odiazib ff899f4
Fixing typo.
odiazib c8b26c3
Fixing typo.
odiazib a469448
Fixing typo.
odiazib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
inputs=${TCHEM_INSTALL_PATH}/examples/runs/atmospheric_chemistry/CB05CL_AE5_w_simpolSOA | ||
inputfile_particles=${inputs}/scenario_conditions_particle.yaml | ||
chemfile=${inputs}/config_full_gas.yaml | ||
aerofile=${inputs}/mechanism_aero.yaml | ||
|
||
export scenario_n_inputs="--chemfile=$chemfile \ | ||
--aerofile=$aerofile \ | ||
--inputfile_particles=$inputfile_particles" |
23 changes: 23 additions & 0 deletions
23
scripts/aerosol_performance/CB05CL_AE5_w_simpolSOA/runCUDA.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export DEVICE=GPU | ||
export experiment_exe_root=${experiment_base}${experiment_suffix} | ||
export sacado_flag=$sflag | ||
echo "sacado flag = ${sacado_flag}" | ||
source ../loadGPU_WS.sh | ||
source ./inputs.sh | ||
|
||
export experiment_name="${experiment_name}-${sacado_flag}" | ||
echo "experiment name is ${experiment_name}" | ||
echo "experiment exe is ${exec}" | ||
use_cloned_samples=true | ||
# change to true if you want to output the reaction rates outputs. | ||
verbose=false | ||
#we will save outputs in this directory | ||
tchem_outputs=CUDA | ||
mkdir -p ${tchem_outputs}/${experiment_name} | ||
nbatch=(72 144 216) | ||
# 288 360 432 504 576 648 720 792 864 936 1008) | ||
# let's use for now 1 and 1 for team and vector size; however, we need to tune up these parameters. | ||
vector_size=(1) | ||
team_size=(1) | ||
nparticles=(1 10 100 1000) | ||
source ../runThisGPU.sh |
24 changes: 24 additions & 0 deletions
24
scripts/aerosol_performance/CB05CL_AE5_w_simpolSOA/runHOSTWS.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export DEVICE=CPU | ||
export experiment_exe_root=${experiment_base}${experiment_suffix} | ||
export sacado_flag=$sflag | ||
echo "sacado flag = ${sacado_flag}" | ||
source ../loadCPU_WS.sh | ||
source ./inputs.sh | ||
|
||
export experiment_name="${experiment_name}-${sacado_flag}" | ||
echo "experiment name is ${experiment_name}" | ||
echo "experiment exe is ${exec}" | ||
use_cloned_samples=true | ||
# change to true if you want to output the reaction rates outputs. | ||
verbose=false | ||
#we will save outputs in this directory | ||
tchem_outputs=HOST | ||
mkdir -p ${tchem_outputs}/${experiment_name} | ||
#20 100 1000 10000 100000 200000 500000 1000000 2000000 3000000 4500000 | ||
nbatch=(1) | ||
# 144 216 288) | ||
# 360 432 504 576 648 720 792 864 936 1008) | ||
Nthread=(52 104) | ||
nparticles=(1 10 50 100) | ||
# 500 1000 5000 10000 | ||
source ../runThisCPU.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export KOKKOS_TOOLS_LIBS=/path/kokkostools/libs/libkp_kernel_timer.so | ||
TCHEM_INSTALL_PATH=/path/tchem/install | ||
exec=${TCHEM_INSTALL_PATH}/examples/${experiment_exe_root}.x | ||
machine_name=/name/machine | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#measure wall times for the following mechanisms | ||
dirs=(CB05CL_AE5_w_simpolSOA) | ||
sacado_flags=(no_sacado) | ||
export experiment_base=TChem_AerosolChemistry | ||
|
||
cpu_solver_strList=( | ||
# "trbdf" | ||
# "kokkoskernels" | ||
# "cvode" | ||
"rhss" | ||
) | ||
cpu_exe_string=( | ||
# "" | ||
# "_KokkosKernels" | ||
# "_CVODE" | ||
"_RHSs" | ||
) | ||
gpu_solver_strList=( | ||
# "trbdf" | ||
# "kokkoskernels" | ||
#"rhss" | ||
) | ||
gpu_exe_string=( | ||
# "" | ||
# "_KokkosKernels" | ||
#"_RHSs" | ||
) | ||
|
||
rhss_params(){ | ||
export numerical_params="" | ||
} | ||
trbdf_params(){ | ||
t_iterPerInt=1 | ||
min_dt='1e-3' | ||
max_dt='1' | ||
atol_t='1e-12' | ||
tol_time='1e-3' | ||
tend='1' | ||
export numerical_params="--tol-time=$tol_time \ | ||
--time-iterations-per-interval=$t_iterPerInt \ | ||
--dtmin=$min_dt \ | ||
--dtmax=$max_dt \ | ||
--atol-time=${atol_t} \ | ||
--tend=$tend \ | ||
--atol-newton=1e-18 \ | ||
--rtol-newton=1e-8 \ | ||
--max-newton-iterations=20 \ | ||
--max-time-iterations=20000 " | ||
|
||
} | ||
|
||
kokkoskernels_params(){ | ||
t_iterPerInt=1 | ||
min_dt='1e-1' | ||
max_dt='1' | ||
atol_t='1e-12' | ||
tol_time='1e-3' | ||
tend='1' | ||
export numerical_params="--tol-time=$tol_time \ | ||
--time-iterations-per-interval=$t_iterPerInt \ | ||
--dtmin=$min_dt \ | ||
--dtmax=$max_dt \ | ||
--atol-time=${atol_t} \ | ||
--tend=$tend " | ||
} | ||
|
||
cvode_params(){ | ||
t_iterPerInt=10 | ||
min_dt='1e-20' | ||
max_dt='1' | ||
atol_t='1e-12' | ||
tol_time='1e-3' | ||
tend='1' | ||
export numerical_params="--tol-time=$tol_time \ | ||
--time-iterations-per-interval=$t_iterPerInt \ | ||
--dtmin=$min_dt \ | ||
--dtmax=$max_dt \ | ||
--use-cvode=true \ | ||
--atol-time=${atol_t} \ | ||
--tend=$tend " | ||
} | ||
|
||
exe=runHOSTWS.sh | ||
for i in "${!cpu_solver_strList[@]}"; do | ||
export experiment_name="${cpu_solver_strList[i]}" | ||
export experiment_suffix="${cpu_exe_string[i]}" | ||
params_fxn="${experiment_name}_params" | ||
printf "setting variables for %s case (CPU)\n" "${experiment_name}" | ||
${params_fxn} | ||
for dir in ${dirs[@]}; do | ||
for sacado in ${sacado_flags[@]}; do | ||
if [ "${experiment_name}" == "expEuler" ] && [ "${sacado}" == "sacado" ]; then | ||
continue | ||
elif [ "${experiment_name}" == "cvode" ] && [ "${sacado}" == "sacado" ]; then | ||
continue | ||
fi | ||
export sflag=$sacado | ||
run_this="cd $dir;./$exe;cd -" | ||
echo $run_this | ||
eval $run_this | ||
done | ||
done | ||
echo "end of outer loop" | ||
done | ||
|
||
exe=runCUDA.sh | ||
for i in "${!gpu_solver_strList[@]}"; do | ||
export experiment_name="${gpu_solver_strList[i]}" | ||
export experiment_suffix="${gpu_exe_string[i]}" | ||
params_fxn="${experiment_name}_params" | ||
printf "setting variables for %s case (GPU)\n" "${experiment_name}" | ||
${params_fxn} | ||
for dir in ${dirs[@]}; do | ||
for sacado in ${sacado_flags[@]}; do | ||
if [ "${experiment_name}" == "expEuler" ] && [ "${sacado}" == "sacado" ]; then | ||
continue | ||
fi | ||
export sflag=$sacado | ||
run_this="cd $dir;./$exe;cd -" | ||
echo $run_this | ||
eval $run_this | ||
done | ||
done | ||
echo "end of outer loop" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
for number_of_particles in ${nparticles[@]}; do | ||
for N in ${nbatch[@]}; do | ||
for threads in ${Nthread[@]}; do | ||
echo "nbatch = $N" | ||
echo "Nthread = $threads" | ||
thread_size=${threads} | ||
output_wall_times="${tchem_outputs}/${experiment_name}/wall_times_nbatch_${N}_thread_size_${thread_size}_number_of_particles${number_of_particles}.json" | ||
output="${tchem_outputs}/${experiment_name}/reaction_rates_nbatch_${N}_thread_size_${thread_size}_number_of_particles${number_of_particles}.txt" | ||
echo "${tchem_outputs}" | ||
echo "${experiment_name}" | ||
echo "/reaction_rates_nbatch_${N}_thread_size_${thread_size}.txt" | ||
echo "output file = " $output | ||
run_this="OMP_NUM_THREADS=$thread_size OMP_PLACES=threads OMP_PROC_BIND=close ${exec} \ | ||
--batch_size=$N \ | ||
--use_cloned_samples=$use_cloned_samples \ | ||
--verbose=$verbose \ | ||
--outputfile_times=$output_wall_times \ | ||
--outputfile=$output \ | ||
--number_of_particles=$number_of_particles \ | ||
$scenario_n_inputs \ | ||
$numerical_params " | ||
echo $run_this | ||
eval $run_this | ||
sleep 2 | ||
# Note: we use this with kokkos tools | ||
kp_json_writer $machine_name* > "${tchem_outputs}/${experiment_name}/simple_timer_nbatch_${N}_thread_size_${thread_size}_number_of_particles${number_of_particles}.json" | ||
sleep 2 | ||
rm -rf $machine_name* | ||
done | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
for number_of_particles in ${nparticles[@]}; do | ||
for N in ${nbatch[@]}; do | ||
for i in "${!vector_size[@]}"; do | ||
vector_thread_size=${vector_size[i]} | ||
team_thread_size=${team_size[i]} | ||
echo "nbatch = $N" | ||
echo "vector thread size = $vector_thread_size" | ||
echo "team thread size = $team_thread_size" | ||
output_wall_times="${tchem_outputs}/${experiment_name}/wall_times_nbatch_${N}_vecsize_${vector_thread_size}_teamThread_size_${team_thread_size}_number_of_particles${number_of_particles}.json" | ||
output_file="${tchem_outputs}/${experiment_name}/reaction_rates_nbatch_${N}_vecsize_${vector_thread_size}_teamThread_size_${team_thread_size}_number_of_particles${number_of_particles}.txt" | ||
echo "${tchem_outputs}" | ||
echo "${experiment_name}" | ||
echo "/reaction_rates_nbatch_${N}_vecsize_${vector_thread_size}_teamThread_size_${team_thread_size}.txt" | ||
echo "output file = ${output_file}" | ||
run_this="OMP_NUM_THREADS=1 OMP_PLACES=threads OMP_PROC_BIND=close $exec \ | ||
--batch_size=$N \ | ||
--team_thread_size=$vector_thread_size \ | ||
--vector_thread_size=$vector_thread_size \ | ||
--use_cloned_samples=$use_cloned_samples \ | ||
--verbose=$verbose \ | ||
--outputfile_times=$output_wall_times \ | ||
--outputfile=$output_file \ | ||
$scenario_n_inputs \ | ||
$numerical_params " | ||
echo $run_this | ||
eval $run_this | ||
sleep 2 | ||
kp_json_writer $machine_name* > "${tchem_outputs}/${experiment_name}/simple_timer_nbatch_${N}_vecsize_${vector_thread_size}_teamThread_size_${team_thread_size}_number_of_particles${number_of_particles}.json" | ||
sleep 2 | ||
rm -rf $machine_name* | ||
done | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
MY_CC=gcc | ||
MY_CXX=g++ | ||
JFLAG="-j 10" | ||
|
||
REPO_BASE=${PWD}/kokkos-tools | ||
BUILD_BASE=${PWD}/kokkos-tools | ||
INSTALL_BASE=${PWD}/kokkos-tools | ||
|
||
get_kokkostools (){ | ||
echo "get kokkostools:" | ||
if [ -d "${KOKKOSTOOLS_REPOSITORY_PATH}" ] && [ "$(ls -A ${KOKKOSTOOLS_REPOSITORY_PATH})" ]; then | ||
echo "${KOKKOSTOOLS_REPOSITORY_PATH} exists and is not empty ... aborting clone"; return | ||
fi | ||
git clone https://github.com/kokkos/kokkos-tools.git ${KOKKOSTOOLS_REPOSITORY_PATH} | ||
} | ||
|
||
build_install_kokkostools(){ | ||
echo "Building kokkos tools:" | ||
mkdir ${KOKKOSTOOLS_BUILD_PATH} | ||
cd ${KOKKOSTOOLS_BUILD_PATH} | ||
cmake \ | ||
-D CMAKE_INSTALL_PREFIX=${KOKKOSTOOLS_INSTALL_PATH} \ | ||
-D CMAKE_CXX_COMPILER="${MY_CXX}" \ | ||
-D CMAKE_C_COMPILER="${MY_CC}" \ | ||
-D CMAKE_BUILD_TYPE=RELEASE \ | ||
${KOKKOSTOOLS_REPOSITORY_PATH} | ||
make ${JFLAG} install | ||
} | ||
KOKKOSTOOLS_REPOSITORY_PATH=${REPO_BASE}/main | ||
KOKKOSTOOLS_BUILD_PATH=${BUILD_BASE}/build | ||
KOKKOSTOOLS_INSTALL_PATH=${INSTALL_BASE}/install | ||
|
||
get_kokkostools | ||
build_install_kokkostools | ||
|
||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,10 +84,10 @@ struct Aerosol_RHS | |
work, | ||
kmcd); | ||
// 2. update RHS of gas and aerosol species | ||
member.team_barrier(); | ||
// member.team_barrier(); | ||
using SIMPOL_single_particle_type = TChem::Impl::SIMPOL_single_particle<real_type, device_type >; | ||
Kokkos::parallel_for( | ||
Kokkos::TeamThreadRange(member, amcd.nParticles), | ||
Kokkos::ThreadVectorRange(member, amcd.nParticles), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not suggesting this needs to change, but I am curious what the range policy thread vector range does instead of using team thread range in this parallel for? |
||
[&](const ordinal_type& i_part) { | ||
for (size_t i_simpol = 0; i_simpol < amcd.nSimpol_tran; i_simpol++) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider using some sort of preprocessor directive for debug print statements