From dbb5b8d45f106ce35c1db8ba1a08e9653d22fa8e Mon Sep 17 00:00:00 2001 From: David Valin Date: Fri, 8 May 2026 09:02:07 -0400 Subject: [PATCH 1/2] Add option to designate the build option NTIME --- README.md | 2 ++ streams/streams_extra/run_stream | 7 ++++++- streams/streams_run | 13 +++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9a809a9..2de1fa5 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ Streams Options: --cache_start_factor : Start the cache size at base cache * . Default is 1. --cache_cap_size : Caps the size of cache to this value. Default is no cap (0). --nsizes : Maximum number of cache sizes to test. Default is 4. + --ntimes : Sets the compile flag NTIMES to value x. The streams run will" + report the best value of the x runs. --opt2 : If value is not 0, run with O2 optimization level. Default is 1. --opt3 : If value is not 0, run with O3 optimization level. Default is 1. --result_dir : Directory to place results into. Default is diff --git a/streams/streams_extra/run_stream b/streams/streams_extra/run_stream index b634914..49d2d98 100755 --- a/streams/streams_extra/run_stream +++ b/streams/streams_extra/run_stream @@ -47,6 +47,7 @@ ARGUMENT_LIST=( "cache_start_size" "host" "iterations" + "ntimes" "numb_sizes" "optimize_lvl" "pcpdir" @@ -94,6 +95,10 @@ while [[ $# -gt 0 ]]; do iterations=${2} shift 2 ;; + --ntimes) + ntimes=${2} + shift 2 + ;; --numb_sizes) numb_sizes=${2} shift 2 @@ -189,7 +194,7 @@ build_images() continue fi - CC_CMD="gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic" + CC_CMD="gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DNTIMES=${ntimes} -DSTREAM_ARRAY_SIZE=${use_cache} stream_omp_5_10.c -o ${stream} -fno-pic" echo $CC_CMD >> streams_build_options $CC_CMD if [ $? -ne 0 ]; then diff --git a/streams/streams_run b/streams/streams_run index 3ca25fc..c8acb36 100755 --- a/streams/streams_run +++ b/streams/streams_run @@ -24,6 +24,8 @@ array_size="" streams_wrapper_version=1.0 curdir=`pwd` start_time="" +ntimes=100 + end_time="" if [[ $0 == "./"* ]]; then chars=`echo $0 | awk -v RS='/' 'END{print NR-1}'` @@ -369,8 +371,8 @@ set_up_test() run_stream() { cd $run_dir - echo ./run_stream --cache_cap_size ${cache_cap_size} --iterations ${to_times_to_run} --cache_start_size $cache_start_factor --optimize_lvl ${1} --cache_multiply $cache_multiply --numb_sizes $nsizes --thread_multiply $threads_multiple --results_dir ${results_dir} --host ${to_configuration} --size_list ${size_list} --top_dir $curdir $pcp - ./run_stream --cache_cap_size ${cache_cap_size} --iterations ${to_times_to_run} --cache_start_size $cache_start_factor --optimize_lvl ${1} --cache_multiply $cache_multiply --numb_sizes $nsizes --thread_multiply $threads_multiple --results_dir ${results_dir} --host ${to_configuration} --size_list ${size_list} --top_dir $curdir > /tmp/streams_results/${2}_opt_${1} $pcp + echo ./run_stream --cache_cap_size ${cache_cap_size} --iterations ${to_times_to_run} --cache_start_size $cache_start_factor --optimize_lvl ${1} --cache_multiply $cache_multiply --numb_sizes $nsizes --thread_multiply $threads_multiple --results_dir ${results_dir} --host ${to_configuration} --size_list ${size_list} --top_dir $curdir $pcp --ntimes $ntimes + ./run_stream --cache_cap_size ${cache_cap_size} --iterations ${to_times_to_run} --cache_start_size $cache_start_factor --optimize_lvl ${1} --cache_multiply $cache_multiply --numb_sizes $nsizes --thread_multiply $threads_multiple --results_dir ${results_dir} --host ${to_configuration} --size_list ${size_list} --top_dir $curdir > /tmp/streams_results/${2}_opt_${1} $pcp --ntimes $ntimes if [ $? -ne 0 ]; then echo "Execution of run stream failed." exit $E_GENERAL @@ -398,6 +400,8 @@ usage() echo " Default is 1" echo "--cache_cap_size : Caps the size of cache to this value. Default is no cap." echo "--nsizes : Maximum number of cache sizes to do. Default is 4" + echo "--ntimes : Sets the compile flag NTIMES to value x. The streams run will" + echo " report the best value of the x runs. Default value is 100" echo "--opt2 : If value is not 0, then we will run with optimization level" echo " 2. Default value is 1" echo "--opt3 : If value is not 0, then we will run with optimization level" @@ -479,6 +483,7 @@ ARGUMENT_LIST=( "cache_multiply" "cache_start_factor" "nsizes" + "ntimes" "opt2" "opt3" "results_dir" @@ -530,6 +535,10 @@ while [[ $# -gt 0 ]]; do nsizes=${2} shift 2 ;; + --ntimes) + ntimes=${2} + shift 2 + ;; --opt2) opt_two=${2} shift 2 From 05077b11c239fcc037dc2a0cd37ea333f26da8d6 Mon Sep 17 00:00:00 2001 From: David Valin Date: Mon, 18 May 2026 05:45:20 -0400 Subject: [PATCH 2/2] ntumes has to be present in both make lines --- streams/streams_extra/run_stream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streams/streams_extra/run_stream b/streams/streams_extra/run_stream index 49d2d98..f50631c 100755 --- a/streams/streams_extra/run_stream +++ b/streams/streams_extra/run_stream @@ -227,7 +227,7 @@ build_images() streams_exec=$streams_exec" "$stream fi echo gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${test_size} stream_omp_5_10.c -o ${stream} -fno-pic >> streams_build_options - gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DSTREAM_ARRAY_SIZE=${test_size} stream_omp_5_10.c -o ${stream} -fno-pic + gcc ${MOPT} -fopenmp -mcmodel=large ${optim_opt} -DNTIMES=${ntimes} -DSTREAM_ARRAY_SIZE=${test_size} stream_omp_5_10.c -o ${stream} -fno-pic if [ $? -ne 0 ]; then echo Compilation of streams failed. exit $E_GENERAL