Prechádzať zdrojové kódy

src/core/topology.c: minor fixes

Nathalie Furmento 4 rokov pred
rodič
commit
9da05c0dc0
1 zmenil súbory, kde vykonal 16 pridanie a 17 odobranie
  1. 16 17
      src/core/topology.c

+ 16 - 17
src/core/topology.c

@@ -539,20 +539,19 @@ 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_deviceid (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_deviceid == 0
-		? NULL
-		: (int *)uconf->workers_fpga_deviceid,
-		&(config->current_fpga_deviceid),
-		(int *)topology->workers_fpga_deviceid,
-		"STARPU_WORKERS_FPGAID",
-		topology->nhwfpgafpgas,
-		STARPU_FPGA_WORKER);
+        _starpu_initialize_workers_deviceid(uconf->use_explicit_workers_fpga_deviceid == 0
+					    ? NULL
+					    : (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_deviceid (struct _starpu_machine_config *config)
@@ -1178,7 +1177,8 @@ unsigned _starpu_topology_get_nhwpu(struct _starpu_machine_config *config)
 #endif
 
 #if defined(STARPU_USE_FPGA)
-	_starpu_init_fpga();
+	if (config->conf.nfpga != 0)
+		_starpu_init_fpga();
 #endif
 	_starpu_init_topology(config);
 
@@ -1793,7 +1793,7 @@ static int _starpu_init_machine_config(struct _starpu_machine_config *config, in
 	if (nfpga != 0)
 	{
 		/* The user did not disable FPGA. We need to initialize
- 		 * Fpga early to count the number of devices */
+ 		 * FPGA early to count the number of devices */
 		_starpu_init_fpga();
 		int nb_devices;
 		nb_devices = _starpu_fpga_get_device_count();
@@ -1804,7 +1804,7 @@ static int _starpu_init_machine_config(struct _starpu_machine_config *config, in
 			nfpga = nb_devices;
 			if (nfpga > STARPU_MAXFPGADEVS)
 			{
-				_STARPU_DISP("Warning: %d Fpga devices available. Only %d enabled. Use configure option --enable-maxfpgadadev=xxx to update the maximum value of supported Fpga devices.\n", nb_devices, STARPU_MAXFPGADEVS);
+				_STARPU_DISP("Warning: %d FPGA devices available. Only %d enabled. Use configure option --enable-maxfpgadev=xxx to update the maximum value of supported FPGA devices.\n", nb_devices, STARPU_MAXFPGADEVS);
 				nfpga = STARPU_MAXFPGADEVS;
 			}
 		}
@@ -1813,15 +1813,15 @@ static int _starpu_init_machine_config(struct _starpu_machine_config *config, in
 			/* Let's make sure this value is OK. */
 			if (nfpga > nb_devices)
 			{
-				/* The user requires more Fpga devices than
+				/* The user requires more FPGA devices than
 				 * there is available */
-				_STARPU_DISP("Warning: %d Fpga devices requested. Only %d available.\n", nfpga, nb_devices);
+				_STARPU_DISP("Warning: %d FPGA devices requested. Only %d available.\n", nfpga, nb_devices);
 				nfpga = nb_devices;
 			}
 			/* Let's make sure this value is OK. */
 			if (nfpga > STARPU_MAXFPGADEVS)
 			{
-				_STARPU_DISP("Warning: %d Fpga devices requested. Only %d enabled. Use configure option --enable-maxfpgadev=xxx to update the maximum value of supported Fpga devices.\n", nfpga, STARPU_MAXFPGADEVS);
+				_STARPU_DISP("Warning: %d FPGA devices requested. Only %d enabled. Use configure option --enable-maxfpgadev=xxx to update the maximum value of supported Fpga devices.\n", nfpga, STARPU_MAXFPGADEVS);
 				nfpga = STARPU_MAXFPGADEVS;
 			}
 		}
@@ -1857,7 +1857,6 @@ static int _starpu_init_machine_config(struct _starpu_machine_config *config, in
 	topology->nworkers += topology->nfpgafpgas;
 #endif
 
-
 #if defined(STARPU_USE_MIC) || defined(STARPU_USE_MPI_MASTER_SLAVE)
 	    _starpu_init_mp_config(config, &config->conf, no_mp_config);
 #endif