Browse Source

disable asynchronous copy on MIC for now

Samuel Thibault 12 years ago
parent
commit
ede4c0eeb1

+ 13 - 0
configure.ac

@@ -851,6 +851,19 @@ if test x$disable_asynchronous_opencl_copy = xyes ; then
    AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and OpenCL devices])
    AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and OpenCL devices])
 fi
 fi
 
 
+AC_MSG_CHECKING(whether asynchronous MIC copy should be disabled)
+AC_ARG_ENABLE(asynchronous-miccopy, [AS_HELP_STRING([--enable-asynchronous-mic-copy],
+			[enable asynchronous copy between CPU and MIC devices])],
+			enable_asynchronous_mic_copy=$enableval, enable_asynchronous_mic_copy=no)
+disable_asynchronous_mic_copy=no
+if test x$enable_asynchronous_mic_copy = xno ; then
+   disable_asynchronous_mic_copy=yes
+fi
+AC_MSG_RESULT($disable_asynchronous_mic_copy)
+if test x$disable_asynchronous_mic_copy = xyes ; then
+   AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and MIC devices])
+fi
+
 ###############################################################################
 ###############################################################################
 #                                                                             #
 #                                                                             #
 #                                 Drivers                                     #
 #                                 Drivers                                     #

+ 7 - 0
doc/chapters/api.texi

@@ -224,6 +224,13 @@ it is therefore necessary to disable asynchronous data transfers.
 This can also be specified at compilation time by giving to the
 This can also be specified at compilation time by giving to the
 configure script the option @code{--disable-asynchronous-opencl-copy}.
 configure script the option @code{--disable-asynchronous-opencl-copy}.
 
 
+@item @code{int disable_asynchronous_mic_copy} (default = 0)
+This flag should be set to 1 to disable asynchronous copies between
+CPUs and MIC accelerators. This can also be specified with the
+@code{STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY} environment variable.
+This can also be specified at compilation time by giving to the
+configure script the option @code{--disable-asynchronous-mic-copy}.
+
 @item @code{int *cuda_opengl_interoperability} (default = NULL)
 @item @code{int *cuda_opengl_interoperability} (default = NULL)
 This can be set to an array of CUDA device identifiers for which
 This can be set to an array of CUDA device identifiers for which
 @code{cudaGLSetGLDevice} should be called instead of @code{cudaSetDevice}. Its
 @code{cudaGLSetGLDevice} should be called instead of @code{cudaSetDevice}. Its

+ 4 - 0
doc/chapters/configuration.texi

@@ -473,6 +473,10 @@ fail when copying data asynchronously. When using this implementation,
 it is therefore necessary to disable asynchronous data transfers.
 it is therefore necessary to disable asynchronous data transfers.
 @end defvr
 @end defvr
 
 
+@defvr {Environment variable} STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY
+Disable asynchronous copies between CPU and MIC devices.
+@end defvr
+
 @defvr {Environment variable} STARPU_DISABLE_CUDA_GPU_GPU_DIRECT
 @defvr {Environment variable} STARPU_DISABLE_CUDA_GPU_GPU_DIRECT
 Disable direct CUDA transfers from GPU to GPU, and let CUDA copy through RAM
 Disable direct CUDA transfers from GPU to GPU, and let CUDA copy through RAM
 instead. This permits to test the performance effect of GPU-Direct.
 instead. This permits to test the performance effect of GPU-Direct.

+ 3 - 0
include/starpu.h

@@ -134,6 +134,9 @@ struct starpu_conf
 	/* indicate if asynchronous copies to OpenCL devices should be disabled */
 	/* indicate if asynchronous copies to OpenCL devices should be disabled */
 	int disable_asynchronous_opencl_copy;
 	int disable_asynchronous_opencl_copy;
 
 
+	/* indicate if asynchronous copies to MIC devices should be disabled */
+	int disable_asynchronous_mic_copy;
+
 	/* Enable CUDA/OpenGL interoperation on these CUDA devices */
 	/* Enable CUDA/OpenGL interoperation on these CUDA devices */
 	unsigned *cuda_opengl_interoperability;
 	unsigned *cuda_opengl_interoperability;
 	unsigned n_cuda_opengl_interoperability;
 	unsigned n_cuda_opengl_interoperability;

+ 14 - 0
src/core/workers.c

@@ -795,6 +795,14 @@ int starpu_conf_init(struct starpu_conf *conf)
 		conf->disable_asynchronous_opencl_copy = 0;
 		conf->disable_asynchronous_opencl_copy = 0;
 #endif
 #endif
 
 
+#if defined(STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY)
+	conf->disable_asynchronous_mic_copy = 1;
+#else
+	conf->disable_asynchronous_mic_copy = starpu_get_env_number("STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY");
+	if (conf->disable_asynchronous_mic_copy == -1)
+		conf->disable_asynchronous_mic_copy = 0;
+#endif
+
 	/* 64MiB by default */
 	/* 64MiB by default */
 	conf->trace_buffer_size = 64<<20;
 	conf->trace_buffer_size = 64<<20;
 	return 0;
 	return 0;
@@ -828,6 +836,7 @@ void _starpu_conf_check_environment(struct starpu_conf *conf)
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_COPY", &conf->disable_asynchronous_copy);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_COPY", &conf->disable_asynchronous_copy);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY", &conf->disable_asynchronous_cuda_copy);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_CUDA_COPY", &conf->disable_asynchronous_cuda_copy);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY", &conf->disable_asynchronous_opencl_copy);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY", &conf->disable_asynchronous_opencl_copy);
+	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY", &conf->disable_asynchronous_mic_copy);
 }
 }
 
 
 int starpu_init(struct starpu_conf *user_conf)
 int starpu_init(struct starpu_conf *user_conf)
@@ -1288,6 +1297,11 @@ int starpu_asynchronous_opencl_copy_disabled(void)
 	return config.conf->disable_asynchronous_opencl_copy;
 	return config.conf->disable_asynchronous_opencl_copy;
 }
 }
 
 
+int starpu_asynchronous_mic_copy_disabled(void)
+{
+	return config.conf->disable_asynchronous_mic_copy;
+}
+
 unsigned starpu_mic_worker_get_count(void)
 unsigned starpu_mic_worker_get_count(void)
 {
 {
 	int i = 0, count = 0;
 	int i = 0, count = 0;

+ 2 - 12
src/datawizard/copy_driver.c

@@ -323,8 +323,7 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 #ifdef STARPU_USE_MIC
 #ifdef STARPU_USE_MIC
 	case _STARPU_MEMORY_NODE_TUPLE(STARPU_CPU_RAM,STARPU_MIC_RAM):
 	case _STARPU_MEMORY_NODE_TUPLE(STARPU_CPU_RAM,STARPU_MIC_RAM):
 		/* RAM -> MIC */
 		/* RAM -> MIC */
-#	ifdef STARPU_MIC_USE_RMA
-		if (!req || starpu_asynchronous_copy_disabled() ||
+		if (!req || starpu_asynchronous_copy_disabled() || starpu_asynchronous_mic_copy_disabled() ||
 				!(copy_methods->ram_to_mic_async || copy_methods->any_to_any))
 				!(copy_methods->ram_to_mic_async || copy_methods->any_to_any))
 		{
 		{
 			/* this is not associated to a request so it's synchronous */
 			/* this is not associated to a request so it's synchronous */
@@ -347,14 +346,9 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 			_starpu_mic_init_event(&(req->async_channel.event.mic_event), dst_node);
 			_starpu_mic_init_event(&(req->async_channel.event.mic_event), dst_node);
 		}
 		}
 		break;
 		break;
-#	else
-		copy_methods->ram_to_mic(src_interface, src_node, dst_interface, dst_node);
-		break;
-#	endif
 	case _STARPU_MEMORY_NODE_TUPLE(STARPU_MIC_RAM,STARPU_CPU_RAM):
 	case _STARPU_MEMORY_NODE_TUPLE(STARPU_MIC_RAM,STARPU_CPU_RAM):
 		/* MIC -> RAM */
 		/* MIC -> RAM */
-#	ifdef STARPU_MIC_USE_RMA
-		if (!req || starpu_asynchronous_copy_disabled() ||
+		if (!req || starpu_asynchronous_copy_disabled() || starpu_asynchronous_mic_copy_disabled() ||
 				!(copy_methods->mic_to_ram_async || copy_methods->any_to_any))
 				!(copy_methods->mic_to_ram_async || copy_methods->any_to_any))
 		{
 		{
 			/* this is not associated to a request so it's synchronous */
 			/* this is not associated to a request so it's synchronous */
@@ -377,10 +371,6 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 			_starpu_mic_init_event(&(req->async_channel.event.mic_event), src_node);
 			_starpu_mic_init_event(&(req->async_channel.event.mic_event), src_node);
 		}
 		}
 		break;
 		break;
-#	else
-		copy_methods->mic_to_ram(src_interface, src_node, dst_interface, dst_node);
-		break;
-#	endif
 #endif
 #endif
 #ifdef STARPU_USE_SCC
 #ifdef STARPU_USE_SCC
 		/* SCC RAM associated to the master process is considered as
 		/* SCC RAM associated to the master process is considered as

+ 2 - 2
src/drivers/mic/driver_mic_sink.c

@@ -103,7 +103,7 @@ void _starpu_mic_sink_allocate(const struct _starpu_mp_node *mp_node, void *arg,
 	if (posix_memalign(&addr, STARPU_MIC_PAGE_SIZE, size) != 0)
 	if (posix_memalign(&addr, STARPU_MIC_PAGE_SIZE, size) != 0)
 		_starpu_mp_common_send_command(mp_node, STARPU_ERROR_ALLOCATE, NULL, 0);
 		_starpu_mp_common_send_command(mp_node, STARPU_ERROR_ALLOCATE, NULL, 0);
 
 
-#ifdef STARPU_MIC_USE_RMA
+#ifndef STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY
 	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
 	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
 	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);
 	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);
 
 
@@ -124,7 +124,7 @@ void _starpu_mic_sink_free(const struct _starpu_mp_node *mp_node STARPU_ATTRIBUT
 
 
 	void *addr = ((struct _starpu_mic_free_command *)arg)->addr;
 	void *addr = ((struct _starpu_mic_free_command *)arg)->addr;
 	
 	
-#ifdef STARPU_MIC_USE_RMA
+#ifndef STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY
 	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
 	scif_epd_t epd = mp_node->host_sink_dt_connection.mic_endpoint;
 	size_t size = ((struct _starpu_mic_free_command *)arg)->size;
 	size_t size = ((struct _starpu_mic_free_command *)arg)->size;
 	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);
 	size_t window_size = STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size);