Parcourir la source

add more function names for MIC/SCC

Samuel Thibault il y a 12 ans
Parent
commit
6c292a0431

+ 2 - 1
doc/chapters/mic-scc-support.texi

@@ -35,7 +35,8 @@ Defines the path to the COI library. The current default is @code{/opt/intel/mic
 The simplest way to port an application to MIC/SCC is to add the
 @code{cpu_funcs_name} field in the codelet, to provide StarPU with the function
 name of the CPU implementation. StarPU will thus simply use the existing CPU
-implementation (cross-rebuilt in the MIC case).
+implementation (cross-rebuilt in the MIC case). The functions have to be
+globally-visible (i.e. not @code{static}) for StarPU to be able to look them up.
 
 @code{starpu_initialize} also has to be used instead of @code{starpu_init}, so
 as to pass @code{argc} and @code{argv}.

+ 3 - 2
examples/basic_examples/mult.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
@@ -77,7 +77,7 @@ static unsigned zdim = 512;
  * registered data with the "matrix" data interface, we use the matrix macros.
  */
 
-static void cpu_mult(void *descr[], __attribute__((unused))  void *arg)
+void cpu_mult(void *descr[], __attribute__((unused))  void *arg)
 {
 	float *subA, *subB, *subC;
 	uint32_t nxC, nyC, nyA;
@@ -264,6 +264,7 @@ static struct starpu_codelet cl =
         /* we can only execute that kernel on a CPU yet */
         /* CPU implementation of the codelet */
         .cpu_funcs = {cpu_mult, NULL},
+        .cpu_funcs_name = {"cpu_mult", NULL},
         /* the codelet manipulates 3 buffers that are managed by the
          * DSM */
         .nbuffers = 3,

+ 2 - 1
examples/basic_examples/vector_scal_c.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
- * Copyright (C) 2011  Université de Bordeaux 1
+ * Copyright (C) 2011, 2013  Université de Bordeaux 1
  *
  * 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
@@ -43,6 +43,7 @@ static struct starpu_codelet cl =
 	.modes = { STARPU_RW },
 	/* CPU implementation of the codelet */
 	.cpu_funcs = {scal_cpu_func, NULL},
+	.cpu_funcs_name = {"scal_cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
 	/* CUDA implementation of the codelet */
 	.cuda_funcs = {scal_cuda_func, NULL},

+ 1 - 0
examples/filters/fblock.c

@@ -92,6 +92,7 @@ int main(int argc, char **argv)
 	struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
                 .cuda_funcs = {cuda_func, NULL},
 #endif

+ 1 - 0
examples/filters/fmatrix.c

@@ -63,6 +63,7 @@ int main(int argc, char **argv)
         struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
                 .nbuffers = 1,
 		.modes = {STARPU_RW},
 		.name = "matrix_scal"

+ 1 - 0
examples/filters/fvector.c

@@ -46,6 +46,7 @@ int main(int argc, char **argv)
         struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
                 .nbuffers = 1,
 		.modes = {STARPU_RW},
 		.name = "vector_scal"

+ 2 - 1
examples/filters/shadow.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Université de Bordeaux 1
+ * Copyright (C) 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -100,6 +100,7 @@ int main(int argc, char **argv)
         struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
                 .cuda_funcs = {cuda_func, NULL},
 #endif

+ 2 - 1
examples/filters/shadow2d.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Université de Bordeaux 1
+ * Copyright (C) 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -154,6 +154,7 @@ int main(int argc, char **argv)
         struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
                 .cuda_funcs = {cuda_func, NULL},
 #endif

+ 2 - 1
examples/filters/shadow3d.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Université de Bordeaux 1
+ * Copyright (C) 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -121,6 +121,7 @@ int main(int argc, char **argv)
         struct starpu_codelet cl =
 	{
                 .cpu_funcs = {cpu_func, NULL},
+                .cpu_funcs_name = {"cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
                 .cuda_funcs = {cuda_func, NULL},
 #endif

+ 1 - 0
examples/incrementer/incrementer.c

@@ -66,6 +66,7 @@ int main(int argc, char **argv)
 	struct starpu_codelet cl =
 	{
 		.cpu_funcs = {cpu_codelet, NULL},
+		.cpu_funcs_name = {"cpu_codelet", NULL},
 #ifdef STARPU_USE_CUDA
 		.cuda_funcs = {cuda_codelet, NULL},
 #endif

+ 2 - 0
examples/interface/complex_codelet.h

@@ -51,6 +51,7 @@ void compare_complex_codelet(void *descr[], void *_args)
 struct starpu_codelet cl_compare =
 {
 	.cpu_funcs = {compare_complex_codelet, NULL},
+	.cpu_funcs_name = {"compare_complex_codelet", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_R},
 	.name = "cl_compare"
@@ -76,6 +77,7 @@ void display_complex_codelet(void *descr[], void *_args)
 struct starpu_codelet cl_display =
 {
 	.cpu_funcs = {display_complex_codelet, NULL},
+	.cpu_funcs_name = {"display_complex_codelet", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R},
 	.name = "cl_display"

+ 2 - 1
examples/openmp/vector_scal_omp.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  *
  * 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
@@ -65,6 +65,7 @@ static struct starpu_codelet cl =
 	.type = STARPU_FORKJOIN,
 	.max_parallelism = INT_MAX,
 	.cpu_funcs = {scal_cpu_func, NULL},
+	.cpu_funcs_name = {"scal_cpu_func", NULL},
 	.nbuffers = 1,
 	.model = &vector_scal_model,
 };

+ 2 - 1
examples/pi/pi.c

@@ -32,7 +32,7 @@ static unsigned ntasks = 1024;
 
 static unsigned long long nshot_per_task = 16*1024*1024ULL;
 
-static void cpu_kernel(void *descr[], void *cl_arg)
+void cpu_kernel(void *descr[], void *cl_arg)
 {
 	unsigned *directions = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]);
 	unsigned nx = nshot_per_task;
@@ -107,6 +107,7 @@ static struct starpu_perfmodel model =
 static struct starpu_codelet pi_cl =
 {
 	.cpu_funcs = {cpu_kernel, NULL},
+	.cpu_funcs_name = {"cpu_kernel", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {cuda_kernel, NULL},
 #endif

+ 7 - 3
examples/pi/pi_redux.c

@@ -138,7 +138,7 @@ static void parse_args(int argc, char **argv)
  *	Monte-carlo kernel
  */
 
-static void pi_func_cpu(void *descr[], void *cl_arg __attribute__ ((unused)))
+void pi_func_cpu(void *descr[], void *cl_arg __attribute__ ((unused)))
 {
 	int workerid = starpu_worker_get_id();
 
@@ -209,6 +209,7 @@ static struct starpu_perfmodel pi_model =
 static struct starpu_codelet pi_cl =
 {
 	.cpu_funcs = {pi_func_cpu, NULL},
+	.cpu_funcs_name = {"pi_func_cpu", NULL},
 #ifdef STARPU_HAVE_CURAND
 	.cuda_funcs = {pi_func_cuda, NULL},
 #endif
@@ -227,6 +228,7 @@ static struct starpu_perfmodel pi_model_redux =
 static struct starpu_codelet pi_cl_redux =
 {
 	.cpu_funcs = {pi_func_cpu, NULL},
+	.cpu_funcs_name = {"pi_func_cpu", NULL},
 #ifdef STARPU_HAVE_CURAND
 	.cuda_funcs = {pi_func_cuda, NULL},
 #endif
@@ -239,7 +241,7 @@ static struct starpu_codelet pi_cl_redux =
  *	Codelets to implement reduction
  */
 
-static void init_cpu_func(void *descr[], void *cl_arg)
+void init_cpu_func(void *descr[], void *cl_arg)
 {
         unsigned long *val = (unsigned long *)STARPU_VARIABLE_GET_PTR(descr[0]);
         *val = 0;
@@ -257,6 +259,7 @@ static void init_cuda_func(void *descr[], void *cl_arg)
 static struct starpu_codelet init_codelet =
 {
         .cpu_funcs = {init_cpu_func, NULL},
+        .cpu_funcs_name = {"init_cpu_func", NULL},
 #ifdef STARPU_HAVE_CURAND
         .cuda_funcs = {init_cuda_func, NULL},
 #endif
@@ -284,7 +287,7 @@ static void redux_cuda_func(void *descr[], void *cl_arg)
 }
 #endif
 
-static void redux_cpu_func(void *descr[], void *cl_arg)
+void redux_cpu_func(void *descr[], void *cl_arg)
 {
 	unsigned long *a = (unsigned long *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	unsigned long *b = (unsigned long *)STARPU_VARIABLE_GET_PTR(descr[1]);
@@ -295,6 +298,7 @@ static void redux_cpu_func(void *descr[], void *cl_arg)
 static struct starpu_codelet redux_codelet =
 {
 	.cpu_funcs = {redux_cpu_func, NULL},
+	.cpu_funcs_name = {"redux_cpu_func", NULL},
 #ifdef STARPU_HAVE_CURAND
 	.cuda_funcs = {redux_cuda_func, NULL},
 #endif

+ 3 - 2
examples/ppm_downscaler/yuv_downscaler.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
@@ -52,7 +52,7 @@ void parse_args(int argc, char **argv)
 #define FRAMESIZE	sizeof(struct yuv_frame)
 #define NEW_FRAMESIZE	sizeof(struct yuv_new_frame)
 
-static void ds_kernel_cpu(void *descr[], __attribute__((unused)) void *arg)
+void ds_kernel_cpu(void *descr[], __attribute__((unused)) void *arg)
 {
 	uint8_t *input = (uint8_t *)STARPU_MATRIX_GET_PTR(descr[0]);
 	const unsigned input_ld = STARPU_MATRIX_GET_LD(descr[0]);
@@ -86,6 +86,7 @@ static void ds_kernel_cpu(void *descr[], __attribute__((unused)) void *arg)
 static struct starpu_codelet ds_codelet =
 {
 	.cpu_funcs = {ds_kernel_cpu, NULL},
+	.cpu_funcs_name = {"ds_kernel_cpu", NULL},
 	.nbuffers = 2, /* input -> output */
 	.modes = {STARPU_R, STARPU_W},
 	.model = NULL

+ 3 - 0
examples/reductions/dot_product.c

@@ -108,6 +108,7 @@ static struct starpu_codelet init_codelet =
 {
 	.can_execute = can_execute,
 	.cpu_funcs = {init_cpu_func, NULL},
+	.cpu_funcs_name = {"init_cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {init_cuda_func, NULL},
 #endif
@@ -190,6 +191,7 @@ static struct starpu_codelet redux_codelet =
 {
 	.can_execute = can_execute,
 	.cpu_funcs = {redux_cpu_func, NULL},
+	.cpu_funcs_name = {"redux_cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {redux_cuda_func, NULL},
 #endif
@@ -308,6 +310,7 @@ static struct starpu_codelet dot_codelet =
 {
 	.can_execute = can_execute,
 	.cpu_funcs = {dot_cpu_func, NULL},
+	.cpu_funcs_name = {"dot_cpu_func", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {dot_cuda_func, NULL},
 #endif

+ 4 - 1
examples/reductions/minmax_reduction.c

@@ -44,7 +44,7 @@ static starpu_data_handle_t _minmax_handle;
  *	Codelet to create a neutral element
  */
 
-static void minmax_neutral_cpu_func(void *descr[], void *cl_arg)
+void minmax_neutral_cpu_func(void *descr[], void *cl_arg)
 {
 	TYPE *array = (TYPE *)STARPU_VARIABLE_GET_PTR(descr[0]);
 
@@ -58,6 +58,7 @@ static void minmax_neutral_cpu_func(void *descr[], void *cl_arg)
 static struct starpu_codelet minmax_init_codelet =
 {
 	.cpu_funcs = {minmax_neutral_cpu_func, NULL},
+	.cpu_funcs_name = {"minmax_neutral_cpu_func", NULL},
 	.modes = {STARPU_W},
 	.nbuffers = 1,
 	.name = "init"
@@ -86,6 +87,7 @@ void minmax_redux_cpu_func(void *descr[], void *cl_arg)
 static struct starpu_codelet minmax_redux_codelet =
 {
 	.cpu_funcs = {minmax_redux_cpu_func, NULL},
+	.cpu_funcs_name = {"minmax_redux_cpu_func", NULL},
 	.modes = {STARPU_RW, STARPU_R},
 	.nbuffers = 2,
 	.name = "redux"
@@ -122,6 +124,7 @@ void minmax_cpu_func(void *descr[], void *cl_arg)
 static struct starpu_codelet minmax_codelet =
 {
 	.cpu_funcs = {minmax_cpu_func, NULL},
+	.cpu_funcs_name = {"minmax_cpu_func", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_REDUX},
 	.name = "minmax"

+ 1 - 0
examples/spmd/vector_scal_spmd.c

@@ -84,6 +84,7 @@ static struct starpu_codelet cl =
 	.type = STARPU_SPMD,
 	.max_parallelism = INT_MAX,
 	.cpu_funcs = {scal_cpu_func, NULL},
+	.cpu_funcs_name = {"scal_cpu_func", NULL},
 	.nbuffers = 1,
 	.model = &vector_scal_model,
 };

+ 7 - 4
examples/stencil/stencil-kernels.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  * Copyright (C) 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -376,7 +376,7 @@ fprintf(stderr,"!!! DO update_func_opencl z %d OPENCL%d !!!\n", block->bz, worke
 /*
  * cl_update (CPU version)
  */
-static void update_func_cpu(void *descr[], void *arg)
+void update_func_cpu(void *descr[], void *arg)
 {
 	struct block_description *block = (struct block_description *) arg;
 	int workerid = starpu_worker_get_id();
@@ -457,6 +457,7 @@ static struct starpu_perfmodel cl_update_model =
 struct starpu_codelet cl_update =
 {
 	.cpu_funcs = {update_func_cpu, NULL},
+	.cpu_funcs_name = {"update_func_cpu", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {update_func_cuda, NULL},
 #endif
@@ -541,7 +542,7 @@ unsigned top_per_worker[STARPU_NMAXWORKERS];
 unsigned bottom_per_worker[STARPU_NMAXWORKERS];
 
 /* top save, CPU version */
-static void dummy_func_top_cpu(void *descr[] __attribute__((unused)), void *arg)
+void dummy_func_top_cpu(void *descr[] __attribute__((unused)), void *arg)
 {
 	struct block_description *block = (struct block_description *) arg;
 	int workerid = starpu_worker_get_id();
@@ -557,7 +558,7 @@ static void dummy_func_top_cpu(void *descr[] __attribute__((unused)), void *arg)
 }
 
 /* bottom save, CPU version */
-static void dummy_func_bottom_cpu(void *descr[] __attribute__((unused)), void *arg)
+void dummy_func_bottom_cpu(void *descr[] __attribute__((unused)), void *arg)
 {
 	struct block_description *block = (struct block_description *) arg;
 	int workerid = starpu_worker_get_id();
@@ -657,6 +658,7 @@ static struct starpu_perfmodel save_cl_top_model =
 struct starpu_codelet save_cl_bottom =
 {
 	.cpu_funcs = {dummy_func_bottom_cpu, NULL},
+	.cpu_funcs_name = {"dummy_func_bottom_cpu", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {dummy_func_bottom_cuda, NULL},
 #endif
@@ -671,6 +673,7 @@ struct starpu_codelet save_cl_bottom =
 struct starpu_codelet save_cl_top =
 {
 	.cpu_funcs = {dummy_func_top_cpu, NULL},
+	.cpu_funcs_name = {"dummy_func_top_cpu", NULL},
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {dummy_func_top_cuda, NULL},
 #endif

+ 3 - 2
examples/stencil/stencil-tasks.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010, 2013  Université de Bordeaux 1
  * Copyright (C) 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -213,11 +213,12 @@ void create_task_update(unsigned iter, unsigned z, int local_rank)
 }
 
 /* Dummy empty codelet taking one buffer */
-static void null_func(void *descr[] __attribute__((unused)), void *arg __attribute__((unused))) { }
+void null_func(void *descr[] __attribute__((unused)), void *arg __attribute__((unused))) { }
 static struct starpu_codelet null =
 {
 	.modes = { STARPU_W, STARPU_W },
 	.cpu_funcs = {null_func, NULL},
+	.cpu_funcs_name = {"null_func", NULL},
 	.cuda_funcs = {null_func, NULL},
 	.opencl_funcs = {null_func, NULL},
 	.nbuffers = 2