Browse Source

minor fixes and renaming

Nathalie Furmento 4 years ago
parent
commit
727de0ed15

+ 13 - 0
configure.ac

@@ -1790,6 +1790,19 @@ if test x$disable_asynchronous_mpi_master_slave_copy = xyes ; then
    AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY], [1], [Define to 1 to disable asynchronous copy between MPI Master and MPI Slave devices])
 fi
 
+AC_MSG_CHECKING(whether asynchronous FPGA copy should be disabled)
+AC_ARG_ENABLE(asynchronous-fpga-copy, [AS_HELP_STRING([--disable-asynchronous-fpga-copy],
+			[disable asynchronous copy between CPU and FPGA devices])],
+			enable_asynchronous_fpga_copy=$enableval, enable_asynchronous_fpga_copy=yes)
+disable_asynchronous_fpga_copy=no
+if test x$enable_asynchronous_fpga_copy = xno ; then
+   disable_asynchronous_fpga_copy=yes
+fi
+AC_MSG_RESULT($disable_asynchronous_fpga_copy)
+if test x$disable_asynchronous_fpga_copy = xyes ; then
+   AC_DEFINE([STARPU_DISABLE_ASYNCHRONOUS_FPGA_COPY], [1], [Define to 1 to disable asynchronous copy between CPU and FPGA devices])
+fi
+
 ###############################################################################
 #                                                                             #
 #                                 MIC settings                                #

+ 7 - 0
doc/doxygen/chapters/510_configure_options.doxy

@@ -378,6 +378,13 @@ Enable the FPGA driver support, and optionally specify the location of
 the FPGA library.
 </dd>
 
+<dt>--disable-asynchronous-fpga-copy</dt>
+<dd>
+\anchor disable-asynchronous-fpga-copy
+\addindex __configure__--disable-asynchronous-fpga-copy
+Disable asynchronous copies between CPU and FPGA devices.
+</dd>
+
 </dl>
 
 \section ExtensionConfiguration Extension Configuration

+ 37 - 9
include/starpu.h

@@ -244,10 +244,6 @@ struct starpu_conf
 	   STARPU_WORKERS_OPENCLID.
 	   (default = 0)
 	*/
-
-        unsigned use_explicit_workers_fpga_fpgaid;
-	unsigned workers_fpga_fpgaid[STARPU_NMAXWORKERS];
-
 	unsigned use_explicit_workers_opencl_gpuid;
 
 	/**
@@ -294,6 +290,24 @@ struct starpu_conf
 	unsigned workers_mpi_ms_deviceid[STARPU_NMAXWORKERS];
 
 	/**
+	   If this flag is set, the FPGA workers will be attached to
+	   the FPGA devices specified in the
+	   starpu_conf::workers_fpga_deviceid array. Otherwise, StarPU
+	   affects the FPGA devices in a round-robin fashion. This
+	   can also be specified with the environment variable \ref
+	   STARPU_WORKERS_FPGAID.
+	   (default = 0)
+	*/
+        unsigned use_explicit_workers_fpga_deviceid;
+
+	/**
+	   If the starpu_conf::use_explicit_workers_fpga_deviceid flag
+	   is set, this array contains the logical identifiers of the
+	   FPGA devices to be used.
+	*/
+	unsigned workers_fpga_deviceid[STARPU_NMAXWORKERS];
+
+	/**
 	   If this flag is set, StarPU will recalibrate the bus.  If
 	   this value is equal to -1, the default value is used. This
 	   can also be specified with the environment variable \ref
@@ -364,8 +378,6 @@ struct starpu_conf
 	   "--disable-asynchronous-cuda-copy".
 	   (default = 0)
 	*/
-
-        int disable_asynchronous_fpga_copy;
 	int disable_asynchronous_cuda_copy;
 
 	/**
@@ -412,6 +424,19 @@ struct starpu_conf
 	int disable_asynchronous_mpi_ms_copy;
 
 	/**
+	   This flag should be set to 1 to disable asynchronous copies
+	   between CPUs and FPGA devices.
+	   This can also be specified with the environment variable
+	   \ref STARPU_DISABLE_ASYNCHRONOUS_FPGA_COPY.
+	   This can also be specified at compilation time by giving to
+	   the configure script the option \ref
+	   disable-asynchronous-fpga-copy
+	   "--disable-asynchronous-fpga-copy".
+	   (default = 0).
+	*/
+        int disable_asynchronous_fpga_copy;
+
+	/**
 	   Enable CUDA/OpenGL interoperation on these CUDA devices.
 	   This can be set to an array of CUDA device identifiers for
 	   which \c cudaGLSetGLDevice() should be called instead of \c
@@ -603,9 +628,6 @@ int starpu_asynchronous_cuda_copy_disabled(void);
    Return 1 if asynchronous data transfers between CPU and OpenCL
    accelerators are disabled.
 */
-
-int starpu_asynchronous_fpga_copy_disabled(void);
-
 int starpu_asynchronous_opencl_copy_disabled(void);
 
 /**
@@ -620,6 +642,12 @@ int starpu_asynchronous_mic_copy_disabled(void);
 */
 int starpu_asynchronous_mpi_ms_copy_disabled(void);
 
+/**
+   Return 1 if asynchronous data transfers between CPU and FPGA
+   devices are disabled.
+*/
+int starpu_asynchronous_fpga_copy_disabled(void);
+
 void starpu_display_stats(void);
 
 void starpu_get_version(int *major, int *minor, int *release);

+ 27 - 0
include/starpu_data_interfaces.h

@@ -128,6 +128,11 @@ struct starpu_data_copy_methods
 	*/
 	int (*ram_to_mic)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
 
+	/**
+	   Define how to copy data from the \p src_interface interface on the
+	   \p src_node CPU node to the \p dst_interface interface on the \p
+	   dst_node FPGA node. Return 0 on success.
+	*/
 	int (*ram_to_fpga)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
 
 	/**
@@ -179,6 +184,11 @@ struct starpu_data_copy_methods
 	*/
 	int (*mic_to_ram)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
 
+	/**
+	   Define how to copy data from the \p src_interface interface on the
+	   \p src_node FPGA node to the \p dst_interface interface on the \p
+	   dst_node CPU node. Return 0 on success.
+	*/
 	int (*fpga_to_ram)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
 
 	/**
@@ -325,7 +335,24 @@ struct starpu_data_copy_methods
 	*/
 	int (*mic_to_ram_async)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
 
+	/**
+	   Define how to copy data from the \p src_interface interface on the
+	   \p src_node CPU node to the \p dst_interface interface on the \p
+	   dst_node FPGA node. Must return 0 if the transfer was actually
+	   completed completely synchronously, or <c>-EAGAIN</c> if at least
+	   some transfers are still ongoing and should be awaited for by the
+	   core.
+	*/
 	int (*ram_to_fpga_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
+
+	/**
+	   Define how to copy data from the \p src_interface interface on the
+	   \p src_node FPGA node to the \p dst_interface interface on the \p
+	   dst_node CPU node. Must return 0 if the transfer was actually
+	   completed completely synchronously, or <c>-EAGAIN</c> if at least
+	   some transfers are still ongoing and should be awaited for by the
+	   core.
+	*/
 	int (*fpga_to_ram_async)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
 
 	/**

+ 10 - 10
src/core/topology.c

@@ -539,27 +539,27 @@ static inline int _starpu_get_next_cuda_gpuid(struct _starpu_machine_config *con
 #endif
 
 #if defined(STARPU_USE_FPGA)
-static void _starpu_initialize_workers_fpga_fpgaid (struct _starpu_machine_config *config)
+static void _starpu_initialize_workers_fpga_deviceid (struct _starpu_machine_config *config)
 {
 	struct _starpu_machine_topology *topology = &config->topology;
 	struct starpu_conf *uconf = &config->conf;
 
         _starpu_initialize_workers_deviceid (
-		uconf->use_explicit_workers_fpga_fpgaid == 0
+		uconf->use_explicit_workers_fpga_deviceid == 0
 		? NULL
-		: (int *)uconf->workers_fpga_fpgaid,
-		&(config->current_fpga_fpgaid),
-		(int *)topology->workers_fpga_fpgaid,
+		: (int *)uconf->workers_fpga_deviceid,
+		&(config->current_fpga_deviceid),
+		(int *)topology->workers_fpga_deviceid,
 		"STARPU_WORKERS_FPGAID",
 		topology->nhwfpgafpgas,
 		STARPU_FPGA_WORKER);
 }
 
-static inline int _starpu_get_next_fpga_fpgaid (struct _starpu_machine_config *config)
+static inline int _starpu_get_next_fpga_deviceid (struct _starpu_machine_config *config)
 {
-	unsigned i = ((config->current_fpga_fpgaid++) % config->topology.nfpgafpgas);
+	unsigned i = ((config->current_fpga_deviceid++) % config->topology.nfpgafpgas);
 
-	return (int)config->topology.workers_fpga_fpgaid[i];
+	return (int)config->topology.workers_fpga_deviceid[i];
 }
 #endif
 
@@ -1830,13 +1830,13 @@ static int _starpu_init_machine_config(struct _starpu_machine_config *config, in
 	topology->nfpgafpgas = nfpga;
 	STARPU_ASSERT(topology->nfpgafpgas + topology->nworkers <= STARPU_NMAXWORKERS);
 
-	_starpu_initialize_workers_fpga_fpgaid(config);
+	_starpu_initialize_workers_fpga_deviceid(config);
 
 	unsigned fpgafpga;
 	for (fpgafpga = 0; fpgafpga < topology->nfpgafpgas; fpgafpga++)
 	{
 		int worker_idx = topology->nworkers + fpgafpga;
-		int devid = _starpu_get_next_fpga_fpgaid(config);
+		int devid = _starpu_get_next_fpga_deviceid(config);
 		if (devid == -1)
 		{ // There is no more devices left
 			topology->nfpgafpgas = fpgafpga;

+ 14 - 5
src/core/workers.c

@@ -1125,7 +1125,7 @@ int starpu_conf_init(struct starpu_conf *conf)
 	conf->use_explicit_workers_bindid = 0; /* TODO */
 	conf->use_explicit_workers_cuda_gpuid = 0; /* TODO */
 	conf->use_explicit_workers_opencl_gpuid = 0; /* TODO */
-	conf->use_explicit_workers_fpga_fpgaid = 0; /* TODO */
+	conf->use_explicit_workers_fpga_deviceid = 0; /* TODO */
 	conf->use_explicit_workers_mic_deviceid = 0; /* TODO */
 	conf->use_explicit_workers_mpi_ms_deviceid = 0; /* TODO */
 
@@ -1166,11 +1166,19 @@ int starpu_conf_init(struct starpu_conf *conf)
 #endif
 
 #if defined(STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY)
-    conf->disable_asynchronous_mpi_ms_copy = 1;
+	conf->disable_asynchronous_mpi_ms_copy = 1;
 #else
-    conf->disable_asynchronous_mpi_ms_copy = starpu_get_env_number("STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY");
-    if(conf->disable_asynchronous_mpi_ms_copy == -1)
-        conf->disable_asynchronous_mpi_ms_copy = 0;
+	conf->disable_asynchronous_mpi_ms_copy = starpu_get_env_number("STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY");
+	if(conf->disable_asynchronous_mpi_ms_copy == -1)
+		conf->disable_asynchronous_mpi_ms_copy = 0;
+#endif
+
+#if defined(STARPU_DISABLE_ASYNCHRONOUS_FPGA_COPY)
+	conf->disable_asynchronous_fpga_copy = 1;
+#else
+	conf->disable_asynchronous_fpga_copy = starpu_get_env_number("STARPU_DISABLE_ASYNCHRONOUS_FPGA_COPY");
+	if (conf->disable_asynchronous_fpga_copy == -1)
+		conf->disable_asynchronous_fpga_copy = 0;
 #endif
 
 	/* 64MiB by default */
@@ -1232,6 +1240,7 @@ void _starpu_conf_check_environment(struct starpu_conf *conf)
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_OPENCL_COPY", &conf->disable_asynchronous_opencl_copy, conf->precedence_over_environment_variables);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_MIC_COPY", &conf->disable_asynchronous_mic_copy, conf->precedence_over_environment_variables);
 	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_MPI_MS_COPY", &conf->disable_asynchronous_mpi_ms_copy, conf->precedence_over_environment_variables);
+	_starpu_conf_set_value_against_environment("STARPU_DISABLE_ASYNCHRONOUS_FPGA_COPY", &conf->disable_asynchronous_fpga_copy, conf->precedence_over_environment_variables);
 }
 
 struct starpu_tree* starpu_workers_get_tree(void)

+ 2 - 2
src/core/workers.h

@@ -356,7 +356,7 @@ struct _starpu_machine_topology
 	 */
 	unsigned workers_opencl_gpuid[STARPU_NMAXWORKERS];
 
-        unsigned workers_fpga_fpgaid[STARPU_NMAXWORKERS];
+        unsigned workers_fpga_deviceid[STARPU_NMAXWORKERS];
 
 	/*** Indicates the successive MIC devices that should be used
 	 * by the MIC driver.  It is either filled according to the
@@ -397,7 +397,7 @@ struct _starpu_machine_config
 	int current_mpi_deviceid;
 
         /* Which FPGA(s) do we use for FPGA? */
-	int current_fpga_fpgaid;
+	int current_fpga_deviceid;
 
 	/** Memory node for cpus, if only one */
 	int cpus_nodeid;