Explorar o código

Add schedulers idle bandwidth testing script

Samuel Thibault %!s(int64=4) %!d(string=hai) anos
pai
achega
b32587cf0f
Modificáronse 3 ficheiros con 85 adicións e 6 borrados
  1. 1 0
      configure.ac
  2. 26 6
      tests/microbenchs/bandwidth.c
  3. 58 0
      tests/microbenchs/bandwidth_scheds.sh

+ 1 - 0
configure.ac

@@ -3524,6 +3524,7 @@ AC_CONFIG_COMMANDS([executable-scripts], [
   test -e tests/microbenchs/parallel_independent_homogeneous_tasks.sh || ln -sf $ac_abs_top_srcdir/tests/microbenchs/parallel_independent_homogeneous_tasks.sh tests/microbenchs/
   test -e tests/microbenchs/parallel_redux_homogeneous_tasks_data.sh || ln -sf $ac_abs_top_srcdir/tests/microbenchs/parallel_redux_homogeneous_tasks_data.sh tests/microbenchs/
   test -e tests/microbenchs/parallel_redux_heterogeneous_tasks_data.sh || ln -sf $ac_abs_top_srcdir/tests/microbenchs/parallel_redux_heterogeneous_tasks_data.sh tests/microbenchs/
+  test -e tests/microbenchs/bandwidth_scheds.sh || ln -sf $ac_abs_top_srcdir/tests/microbenchs/bandwidth_scheds.sh tests/microbenchs/
   mkdir -p tests/energy
   test -e tests/energy/static.sh || ln -sf $ac_abs_top_srcdir/tests/energy/static.sh tests/energy/
   test -e tests/energy/dynamic.sh || ln -sf $ac_abs_top_srcdir/tests/energy/dynamic.sh tests/energy/

+ 26 - 6
tests/microbenchs/bandwidth.c

@@ -25,11 +25,18 @@
  * kernels and number of idle workers.
  */
 
+#ifdef STARPU_QUICK_CHECK
+static size_t size = 1024;
+static unsigned cpustep = 4;
+#else
 /* Must be bigger than available cache size per core, 64MiB should be enough */
 static size_t size = 64UL << 20;
+static unsigned cpustep = 1;
+#endif
 
-static int iter = 30;
-static int ncpus;
+static unsigned noalone = 0;
+static unsigned iter = 30;
+static unsigned ncpus;
 static starpu_pthread_barrier_t barrier;
 static float *result;
 
@@ -64,14 +71,18 @@ static struct starpu_codelet bw_codelet =
 
 static void usage(char **argv)
 {
-	fprintf(stderr, "Usage: %s [-n iter] [-s size (MB)]]\n", argv[0]);
+	fprintf(stderr, "Usage: %s [-n iter] [-s size (MB)] [-i increment] [-a]\n", argv[0]);
+	fprintf(stderr, "\t-n iter\tNumber of iterations\n");
+	fprintf(stderr, "\t-s size\tBuffer size in MB\n");
+	fprintf(stderr, "\t-i increment\tCpu number increment\n");
+	fprintf(stderr, "\t-a\tDo not run the alone test\n");
 	exit(EXIT_FAILURE);
 }
 
 static void parse_args(int argc, char **argv)
 {
 	int c;
-	while ((c = getopt(argc, argv, "n:s:b:i:h")) != -1)
+	while ((c = getopt(argc, argv, "n:s:c:ah")) != -1)
 	switch(c)
 	{
 		case 'n':
@@ -80,6 +91,12 @@ static void parse_args(int argc, char **argv)
 		case 's':
 			size = (long)atoi(optarg) << 20;
 			break;
+		case 'c':
+			cpustep = atoi(optarg);
+			break;
+		case 'a':
+			noalone = 1;
+			break;
 		case 'h':
 			usage(argv);
 			break;
@@ -150,9 +167,12 @@ int main(int argc, char **argv)
 	result = malloc(ncpus * sizeof(result[0]));
 
 	printf("# nw\talone\t\t+idle\t\tidle efficiency\n");
-	for (n = 1; n <= ncpus; n++)
+	for (n = 1; n <= ncpus; n += cpustep)
 	{
-		alone = bench(&argc, &argv, n, 0);
+		if (noalone)
+			alone = 0.;
+		else
+			alone = bench(&argc, &argv, n, 0);
 		idle = bench(&argc, &argv, n, ncpus-n);
 		printf("%d\t%f\t%f\t%f\n", n, alone/1000, idle/1000, idle*100/alone);
 	}

+ 58 - 0
tests/microbenchs/bandwidth_scheds.sh

@@ -0,0 +1,58 @@
+#!/bin/sh
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2016-2020  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+#
+# StarPU is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# StarPU is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# See the GNU Lesser General Public License in COPYING.LGPL for more details.
+#
+
+set -e
+
+if [ -n "$STARPU_SCHED" ]
+then
+	SCHEDS=$STARPU_SCHED
+	DEFAULT=$STARPU_SCHED
+else
+	SCHEDS=`$(dirname $0)/../../tools/starpu_sched_display`
+	DEFAULT=eager
+fi
+
+cat > bandwidth.gp << EOF
+set term postscript eps enhanced color font ",18"
+set output "bandwidth.eps"
+set key top left
+set ylabel "GB/s"
+set xlabel "ncores"
+
+plot \\
+	"bandwidth-$DEFAULT.dat" using 1:2 with lines title "alone", \\
+EOF
+
+for sched in $SCHEDS
+do
+	if [ "$sched" != eager -a "$sched" != "$SCHEDS" ]; then
+		extra=-a
+	else
+		extra=
+	fi
+
+	STARPU_SCHED=$sched $STARPU_LAUNCH $(dirname $0)/bandwidth $extra | tee bandwidth-$sched.dat
+	echo "\"bandwidth-$sched.dat\" using 1:3 with linespoints title \"$sched\", \\" >> bandwidth.gp
+done
+
+if gnuplot bandwidth.gp ; then
+	if [ -n "$STARPU_BENCH_DIR" ]; then
+		cp bandwidth.eps $STARPU_BENCH_DIR/
+	else
+		gv bandwidth.eps &
+	fi
+fi