Просмотр исходного кода

Add a program to force the calibratation of the performance models of the bus.

Cédric Augonnet лет назад: 15
Родитель
Сommit
dfba15ba38
4 измененных файлов с 66 добавлено и 12 удалено
  1. 2 0
      include/starpu-perfmodel.h
  2. 36 12
      src/core/perfmodel/perfmodel_bus.c
  3. 4 0
      tools/Makefile.am
  4. 24 0
      tools/calibrate_bus.c

+ 2 - 0
include/starpu-perfmodel.h

@@ -109,6 +109,8 @@ void starpu_perfmodel_debugfilepath(struct starpu_perfmodel_t *model,
 void starpu_perfmodel_get_arch_name(enum starpu_perf_archtype arch,
 		char *archname, size_t maxlen);
 
+void starpu_force_bus_sampling(void);
+
 #ifdef __cplusplus
 }
 #endif

+ 36 - 12
src/core/perfmodel/perfmodel_bus.c

@@ -318,6 +318,14 @@ static void write_bus_affinity_file_content(void)
 	fclose(f);
 }
 
+static void generate_bus_affinity_file(void)
+{
+	if (!was_benchmarked)
+		benchmark_all_cuda_devices();
+
+	write_bus_affinity_file_content();
+}
+
 static void load_bus_affinity_file(void)
 {
 	int res;
@@ -329,10 +337,7 @@ static void load_bus_affinity_file(void)
 	if (res)
 	{
 		/* File does not exist yet */
-		if (!was_benchmarked)
-			benchmark_all_cuda_devices();
-
-		write_bus_affinity_file_content();
+		generate_bus_affinity_file();
 	}
 
 	load_bus_affinity_file_content();
@@ -428,6 +433,14 @@ static void write_bus_latency_file_content(void)
 	fclose(f);
 }
 
+static void generate_bus_latency_file(void)
+{
+	if (!was_benchmarked)
+		benchmark_all_cuda_devices();
+
+	write_bus_latency_file_content();
+}
+
 static void load_bus_latency_file(void)
 {
 	int res;
@@ -439,10 +452,7 @@ static void load_bus_latency_file(void)
 	if (res)
 	{
 		/* File does not exist yet */
-		if (!was_benchmarked)
-			benchmark_all_cuda_devices();
-
-		write_bus_latency_file_content();
+		generate_bus_latency_file();
 	}
 
 	load_bus_latency_file_content();
@@ -541,6 +551,14 @@ static void write_bus_bandwith_file_content(void)
 	fclose(f);
 }
 
+static void generate_bus_bandwith_file(void)
+{
+	if (!was_benchmarked)
+		benchmark_all_cuda_devices();
+
+	write_bus_bandwith_file_content();
+}
+
 static void load_bus_bandwith_file(void)
 {
 	int res;
@@ -552,10 +570,7 @@ static void load_bus_bandwith_file(void)
 	if (res)
 	{
 		/* File does not exist yet */
-		if (!was_benchmarked)
-			benchmark_all_cuda_devices();
-
-		write_bus_bandwith_file_content();
+		generate_bus_bandwith_file();
 	}
 
 	load_bus_bandwith_file_content();
@@ -565,6 +580,15 @@ static void load_bus_bandwith_file(void)
  *	Generic
  */
 
+void starpu_force_bus_sampling(void)
+{
+	create_sampling_directory_if_needed();
+
+	generate_bus_affinity_file();
+	generate_bus_latency_file();
+	generate_bus_bandwith_file();
+}
+
 void load_bus_performance_files(void)
 {
 	create_sampling_directory_if_needed();

+ 4 - 0
tools/Makefile.am

@@ -23,6 +23,10 @@ bin_PROGRAMS =
 
 CLEANFILES = *.gcno *.gcda *.linkinfo
 
+bin_PROGRAMS += calibrate_bus
+
+calibrate_bus_SOURCES = calibrate_bus.c
+
 if USE_FXT
 bin_PROGRAMS += fxt-tool fxt-stats
 

+ 24 - 0
tools/calibrate_bus.c

@@ -0,0 +1,24 @@
+/*
+ * StarPU
+ * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
+ *
+ * This program 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.
+ *
+ * This program 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.
+ */
+
+#include <starpu.h>
+
+int main(int argc, char **argv)
+{
+	starpu_force_bus_sampling();
+
+	return 0;
+}