diff --git a/benchmark/visu_pool_local_multi.p b/benchmark/visu_pool_local_multi.p new file mode 100644 index 0000000000000000000000000000000000000000..43d0c13677df3f2fda854fe7aec88d7e560bef13 --- /dev/null +++ b/benchmark/visu_pool_local_multi.p @@ -0,0 +1,10 @@ +set terminal png +set output "ju_diff100k.png" +set font "Helvetica" +set title 'Juelich/issue6/1; jupiter; BW; rep1; diff100k; /=decl\_per\_cdo' +set key right +set log y +set xlabel "decl per CDO" +set ylabel "time (ms)" +set style function linespoints +plot 'pool_local_multi.dat' using 2:xtic(1) title "1 thread" with linespoints, '' using 3 title "4 threads" with linespoints, '' using 4 title "8 threads" with linespoints, '' using 5 title "12 threads" with linespoints, '' using 8 title "24 threads" with linespoints diff --git a/benchmark/visu_pool_local_multi.sh b/benchmark/visu_pool_local_multi.sh new file mode 100755 index 0000000000000000000000000000000000000000..eb1f2a2170954a93c60f52b450e119b58cc16c71 --- /dev/null +++ b/benchmark/visu_pool_local_multi.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# +# Post-treatment and visualization of ../tests/check_pool_local_multi +# + +# Copyright (C) 2020 Cray Computer GmbH +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +output="pool_local_multi.dat" +gnuplot_script="visu_pool_local_multi.p" + +../tests/check_pool_local_multi > tmp + +# remove the first two lines and the last three lines (written by `cheat`) +head -n -3 tmp | sed -e '1,2d' > $output + +gnuplot $gnuplot_script diff --git a/tests/check_pool_local_multi.c b/tests/check_pool_local_multi.c index 8268c717c750d895b65519cfc103bdaeb98e0d2d..7ea8eb82081c439199acd5553ff84cef9ae9631a 100644 --- a/tests/check_pool_local_multi.c +++ b/tests/check_pool_local_multi.c @@ -102,7 +102,7 @@ CHEAT_DECLARE( return NULL; } -#define MAX_THREADS 9 /* power-of-two + 1 and >1 */ +#define MAX_THREADS 25 ) CHEAT_TEST(cdo_local_pool_works, @@ -110,16 +110,25 @@ CHEAT_TEST(cdo_local_pool_works, putenv("MSTRO_LOG_LEVEL=0"); srandom(42); cheat_assert(MSTRO_OK == mstro_init("Tests","POOL",0)); - - for(size_t numthr=1; numthr<MAX_THREADS; numthr*=2) { - pthread_t threads[MAX_THREADS]; - for(size_t num_diff=1; num_diff<100001; num_diff*=10) { - for(size_t numdecl=1; numdecl<129; numdecl*=2) { - struct thread_args args; + + fprintf(stdout, "# num_diff=100k; time /= decl_per_cdo"); + + for(size_t numdecl=1; numdecl<129; numdecl*=2) { +// for(size_t num_diff=1; num_diff<100001; num_diff*=10) { + size_t num_diff = 100000; + + struct thread_args args; + args.num_repeats = 100000 / num_diff; + args.num_different_cdos = num_diff; + args.num_max_declares_per_cdo = numdecl; + + fprintf(stdout, "%8zu ", args.num_max_declares_per_cdo); + + + for(size_t numthr=1; numthr<MAX_THREADS; numthr+=4) { + if (numthr==5) numthr--; // yes that's ugly + pthread_t threads[MAX_THREADS]; - args.num_repeats = 100000 / num_diff; - args.num_different_cdos = num_diff; - args.num_max_declares_per_cdo = numdecl; mstro_nanosec_t before = mstro_clock(); @@ -136,12 +145,16 @@ CHEAT_TEST(cdo_local_pool_works, mstro_nanosec_t after = mstro_clock(); double duration = after-before; double ms = duration/(1000.0*1000.0); - fprintf(stdout, "%8zu reps, %8zu different, %8zu per CDO, %3zu threads: %.2f ms\n", +/* fprintf(stdout, "%8zu reps, %8zu different, %8zu per CDO, %3zu threads: %.2f ms\n", args.num_repeats, args.num_different_cdos, args.num_max_declares_per_cdo, numthr, ms); + */ fprintf(stdout, "%.5f ", ms/(double)args.num_max_declares_per_cdo); + } - } +// } + fprintf(stdout, "\n"); + } cheat_assert(global_result==MSTRO_OK);