Bläddra i källkod

Update vibility of STARPU_USE_MPI_MASTER_SLAVE to use it in applications + fix bugs in stencils when using Master-Slave

Corentin Salingue 8 år sedan
förälder
incheckning
d481159bd7

+ 1 - 1
examples/stencil/implicit-stencil-blocks.c

@@ -333,7 +333,7 @@ void allocate_memory_on_node(int rank)
 			starpu_block_data_register(&block->boundaries_handle[B][1], -1, (uintptr_t) NULL, (sizex + 2*K), (sizex + 2*K)*(sizey + 2*K), (sizex + 2*K), (sizey + 2*K), K, sizeof(TYPE));
 		}
 
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI)  && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 		/* Register all data to StarPU-MPI, even the ones that are not
 		 * allocated on the local node. */
 

+ 3 - 3
examples/stencil/implicit-stencil-kernels.c

@@ -192,7 +192,7 @@ static void update_func_cuda(void *descr[], void *arg)
 		FPRINTF(stderr,"!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
 	else
 		DEBUG( "!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d              !!!\n", rank);
@@ -282,7 +282,7 @@ static void update_func_opencl(void *descr[], void *arg)
 		FPRINTF(stderr,"!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
 	else
 		DEBUG( "!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d              !!!\n", rank);
@@ -355,7 +355,7 @@ void update_func_cpu(void *descr[], void *arg)
 		DEBUG("!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
 	else
 		DEBUG("!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d            !!!\n", rank);

+ 1 - 1
examples/stencil/implicit-stencil-tasks.c

@@ -35,7 +35,7 @@
 # define DEBUG(fmt, ...)
 #endif
 
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 #include <starpu_mpi.h>
 #define starpu_insert_task(...) starpu_mpi_insert_task(MPI_COMM_WORLD, __VA_ARGS__)
 #endif

+ 8 - 8
examples/stencil/implicit-stencil.c

@@ -193,7 +193,7 @@ void f(unsigned task_per_worker[STARPU_NMAXWORKERS])
 
 unsigned global_workerid(unsigned local_workerid)
 {
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	unsigned workers_per_node = starpu_worker_get_count();
@@ -210,7 +210,7 @@ int main(int argc, char **argv)
 	int world_size;
 	int ret;
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int thread_support;
 	if (MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &thread_support))
 	{
@@ -237,7 +237,7 @@ int main(int argc, char **argv)
 	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	ret = starpu_mpi_init(NULL, NULL, 0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 #endif
@@ -249,7 +249,7 @@ int main(int argc, char **argv)
 
 	init_problem(argc, argv, rank, world_size);
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int barrier_ret = MPI_Barrier(MPI_COMM_WORLD);
 	STARPU_ASSERT(barrier_ret == MPI_SUCCESS);
 #endif
@@ -270,7 +270,7 @@ int main(int argc, char **argv)
 
 	end = starpu_timing_now();
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	barrier_ret = MPI_Barrier(MPI_COMM_WORLD);
 	STARPU_ASSERT(barrier_ret == MPI_SUCCESS);
 #endif
@@ -288,7 +288,7 @@ int main(int argc, char **argv)
 	double max_timing = timing;
 	double sum_timing = timing;
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int reduce_ret;
 
 	reduce_ret = MPI_Reduce(&timing, &min_timing, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
@@ -368,13 +368,13 @@ int main(int argc, char **argv)
 
 	free_problem(rank);
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	starpu_mpi_shutdown();
 #endif
 
 	starpu_shutdown();
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	MPI_Finalize();
 #endif
 

+ 1 - 1
examples/stencil/implicit-stencil.h

@@ -23,7 +23,7 @@
 #include <starpu.h>
 
 #ifndef __CUDACC__
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 #include <mpi.h>
 #include <starpu_mpi.h>
 #endif

+ 3 - 3
examples/stencil/stencil-kernels.c

@@ -189,7 +189,7 @@ static void update_func_cuda(void *descr[], void *arg)
 		FPRINTF(stderr,"!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
 	else
 		DEBUG( "!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d              !!!\n", rank);
@@ -276,7 +276,7 @@ static void update_func_opencl(void *descr[], void *arg)
 		FPRINTF(stderr,"!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
 	else
 		DEBUG( "!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d              !!!\n", rank);
@@ -346,7 +346,7 @@ void update_func_cpu(void *descr[], void *arg)
 		FPRINTF(stderr,"!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
 	else
 		DEBUG( "!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	DEBUG( "!!!           RANK %d            !!!\n", rank);

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

@@ -81,7 +81,7 @@ static void send_done(void *arg)
 	DEBUG("DO SEND %d\n", (int)z);
 }
 
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 /* Post MPI send */
 static void create_task_save_mpi_send(unsigned iter, unsigned z, int dir, int local_rank)
 {
@@ -136,7 +136,7 @@ void create_task_save(unsigned iter, unsigned z, int dir, int local_rank)
 	int node_z = get_block_mpi_node(z);
 	int node_z_and_d = get_block_mpi_node(z+dir);
 
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	if (node_z == local_rank)
 	{
 		/* Save data from update */

+ 8 - 8
examples/stencil/stencil.c

@@ -188,7 +188,7 @@ void f(unsigned task_per_worker[STARPU_NMAXWORKERS])
 
 unsigned global_workerid(unsigned local_workerid)
 {
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int rank;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 	unsigned workers_per_node = starpu_worker_get_count();
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
 	int world_size;
 	int ret;
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int thread_support;
 	if (MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED, &thread_support))
 	{
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
 	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	ret = starpu_mpi_init(NULL, NULL, 0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 #endif
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
 
 	create_tasks(rank);
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int barrier_ret = MPI_Barrier(MPI_COMM_WORLD);
 	STARPU_ASSERT(barrier_ret == MPI_SUCCESS);
 #endif
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
 
 	end = starpu_timing_now();
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	barrier_ret = MPI_Barrier(MPI_COMM_WORLD);
 	STARPU_ASSERT(barrier_ret == MPI_SUCCESS);
 #endif
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
 
 	/*display_debug(nbz, niter, rank);*/
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	starpu_mpi_shutdown();
 #endif
 
@@ -285,7 +285,7 @@ int main(int argc, char **argv)
 	double max_timing = timing;
 	double sum_timing = timing;
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	int reduce_ret;
 
 	reduce_ret = MPI_Reduce(&timing, &min_timing, 1, MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD);
@@ -366,7 +366,7 @@ int main(int argc, char **argv)
 	free_problem(rank);
 	starpu_shutdown();
 
-#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
+#if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 	MPI_Finalize();
 #endif
 

+ 1 - 1
examples/stencil/stencil.h

@@ -23,7 +23,7 @@
 #include <starpu.h>
 
 #ifndef __CUDACC__
-#ifdef STARPU_USE_MPI
+#if defined(STARPU_USE_MPI) && !defined(STARPU_USE_MPI_MASTER_SLAVE)
 #include <mpi.h>
 #include <starpu_mpi.h>
 #endif

+ 1 - 0
include/starpu_config.h.in

@@ -35,6 +35,7 @@
 #undef STARPU_USE_OPENCL
 #undef STARPU_USE_MIC
 #undef STARPU_USE_SCC
+#undef STARPU_USE_MPI_MASTER_SLAVE
 
 #undef STARPU_OPENMP