Browse Source

dynamically load an empty kernel for the microbench that measure overhead

Cédric Augonnet 16 years ago
parent
commit
554cb8bc74

+ 3 - 2
tests/Makefile.am

@@ -80,6 +80,7 @@ microbenchs_sync_and_notify_data_SOURCES +=	\
 endif
 
 if USE_GORDON
-BUILT_SOURCES += 				\
-	microbenchs/sync_and_notify_data_gordon_kernels.spuelf
+BUILT_SOURCES += 						\
+	microbenchs/sync_and_notify_data_gordon_kernels.spuelf	\
+	microbenchs/null_kernel_gordon.spuelf
 endif

+ 21 - 2
tests/microbenchs/async-tasks-overhead.c

@@ -39,13 +39,30 @@ static starpu_codelet dummy_codelet =
 	.where = ANY,
 	.core_func = dummy_func,
 	.cublas_func = dummy_func,
-#ifdef SPU_FUNC_NULL
-	.gordon_func = SPU_FUNC_NULL,
+#ifdef USE_GORDON
+	.gordon_func = 0, /* this will be defined later */
 #endif
 	.model = NULL,
 	.nbuffers = 0
 };
 
+static void init_gordon_kernel(void)
+{
+#ifdef USE_GORDON
+	unsigned elf_id = 
+		gordon_register_elf_plugin("./microbenchs/null_kernel_gordon.spuelf");
+	gordon_load_plugin_on_all_spu(elf_id);
+
+	unsigned gordon_null_kernel =
+		gordon_register_kernel(elf_id, "empty_kernel");
+	gordon_load_kernel_on_all_spu(gordon_null_kernel);
+
+	dummy_codelet.gordon_func = gordon_null_kernel;
+#endif
+}
+
+
+
 void callback(void *arg)
 {
 	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
@@ -118,6 +135,8 @@ int main(int argc, char **argv)
 
 	starpu_init(&conf);
 
+	init_gordon_kernel();
+
 	fprintf(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);

+ 6 - 0
tests/microbenchs/null_kernel_gordon.c

@@ -0,0 +1,6 @@
+void empty_kernel (__attribute__ ((unused)) void **alloc,
+                __attribute__ ((unused)) void **in,
+                __attribute__ ((unused)) void **inout,
+                __attribute__ ((unused)) void **out)
+{
+}

+ 21 - 2
tests/microbenchs/sync-tasks-overhead.c

@@ -32,13 +32,30 @@ static starpu_codelet dummy_codelet =
 	.where = ANY,
 	.core_func = dummy_func,
 	.cublas_func = dummy_func,
-#ifdef SPU_FUNC_NULL
-	.gordon_func = SPU_FUNC_NULL,
+#ifdef USE_GORDON
+	.gordon_func = 0, /* this will be defined later */
 #endif
 	.model = NULL,
 	.nbuffers = 0
 };
 
+static void init_gordon_kernel(void)
+{
+#ifdef USE_GORDON
+	unsigned elf_id = 
+		gordon_register_elf_plugin("./microbenchs/null_kernel_gordon.spuelf");
+	gordon_load_plugin_on_all_spu(elf_id);
+
+	unsigned gordon_null_kernel =
+		gordon_register_kernel(elf_id, "empty_kernel");
+	gordon_load_kernel_on_all_spu(gordon_null_kernel);
+
+	dummy_codelet.gordon_func = gordon_null_kernel;
+#endif
+}
+
+
+
 void inject_one_task(void)
 {
 	struct starpu_task *task = starpu_task_create();
@@ -75,6 +92,8 @@ int main(int argc, char **argv)
 
 	starpu_init(NULL);
 
+	init_gordon_kernel();
+
 	fprintf(stderr, "#tasks : %d\n", ntasks);
 
 	gettimeofday(&start, NULL);