瀏覽代碼

Let drivers register their information rather than scattering it along StarPU

Samuel Thibault 4 年之前
父節點
當前提交
0f5a6f332c

+ 0 - 1
doc/doxygen_dev/Makefile.am

@@ -172,7 +172,6 @@ dox_inputs = $(DOX_CONFIG) 				\
 	$(top_srcdir)/src/common/list.h	\
 	$(top_srcdir)/src/debug/starpu_debug_helpers.h	\
 	$(top_srcdir)/src/debug/traces/starpu_fxt.h	\
-	$(top_srcdir)/src/starpu_parameters.h	\
 	$(top_srcdir)/src/sched_policies/fifo_queues.h	\
 	$(top_srcdir)/src/sched_policies/helper_mct.h	\
 	$(top_srcdir)/src/sched_policies/sched_component.h	\

+ 0 - 1
doc/doxygen_dev/doxygen-config.cfg.in

@@ -73,7 +73,6 @@ INPUT                  = @top_srcdir@/doc/doxygen_dev/chapters         \
 			 @top_srcdir@/src/common/list.h \
 			 @top_srcdir@/src/debug/starpu_debug_helpers.h \
 			 @top_srcdir@/src/debug/traces/starpu_fxt.h \
-			 @top_srcdir@/src/starpu_parameters.h \
 			 @top_srcdir@/src/sched_policies/fifo_queues.h \
 			 @top_srcdir@/src/sched_policies/helper_mct.h \
 			 @top_srcdir@/src/sched_policies/sched_component.h \

+ 7 - 1
include/starpu_driver.h

@@ -33,7 +33,13 @@ extern "C"
 */
 
 /**
-   structure for a driver
+   Pre-initialize drivers
+   So as to register information on device types, memory types, etc.
+*/
+void starpu_drivers_preinit(void);
+
+/**
+   structure for designating a given driver
 */
 struct starpu_driver
 {

+ 1 - 1
include/starpu_perfmodel.h

@@ -408,7 +408,7 @@ int starpu_perfmodel_set_per_devices_size_base(struct starpu_perfmodel *model, i
 */
 void starpu_perfmodel_debugfilepath(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, char *path, size_t maxlen, unsigned nimpl);
 
-char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype);
+const char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype);
 
 /**
    Return the architecture name for \p arch

+ 4 - 3
include/starpu_worker.h

@@ -49,7 +49,8 @@ enum starpu_node_kind
 	STARPU_OPENCL_RAM=3,
 	STARPU_DISK_RAM=4,
 	STARPU_MIC_RAM=5,
-	STARPU_MPI_MS_RAM=6
+	STARPU_MPI_MS_RAM=6,
+	STARPU_MAX_RAM=6
 };
 
 /**
@@ -316,9 +317,9 @@ unsigned starpu_worker_is_slave_somewhere(int workerid);
 const char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
 
 /**
-   Return worker \p type as a trivial string (CPU, CUDA, etc.)
+   Return worker \p type as a string suitable for environment variable names (CPU, CUDA, etc.)
 */
-const char *starpu_worker_get_type_as_short_string(enum starpu_worker_archtype type);
+const char *starpu_worker_get_type_as_env_var(enum starpu_worker_archtype type);
 
 int starpu_bindid_get_workerids(int bindid, int **workerids);
 

+ 4 - 1
src/Makefile.am

@@ -155,7 +155,6 @@ noinst_HEADERS = 						\
 	util/starpu_clusters_create.h				\
 	util/starpu_task_insert_utils.h				\
 	util/starpu_data_cpy.h					\
-	starpu_parameters.h					\
 	sched_policies/prio_deque.h				\
 	sched_policies/sched_component.h
 
@@ -327,6 +326,7 @@ endif
 
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cpu/driver_cpu.c
 
+libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cuda/driver_cuda_init.c
 if STARPU_USE_CUDA
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cuda/driver_cuda.c
 else
@@ -338,6 +338,7 @@ endif
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cuda/starpu_cublas.c
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/cuda/starpu_cusparse.c
 
+libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/opencl/driver_opencl_init.c
 if STARPU_USE_OPENCL
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/opencl/driver_opencl.c
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/opencl/driver_opencl_utils.c
@@ -382,6 +383,7 @@ endif
 #										#
 #########################################
 
+libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mic/driver_mic_init.c
 if STARPU_USE_MIC
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mic/driver_mic_common.c
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mic/driver_mic_source.c
@@ -395,6 +397,7 @@ endif
 #                                       #
 #########################################
 
+libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mpi/driver_mpi_init.c
 if STARPU_USE_MPI_MASTER_SLAVE
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mpi/driver_mpi_common.c
 libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES += drivers/mpi/driver_mpi_source.c

+ 0 - 1
src/core/disk_ops/disk_leveldb.cpp

@@ -27,7 +27,6 @@
 #include <core/perfmodel/perfmodel.h>
 #include <datawizard/copy_driver.h>
 #include <datawizard/memory_manager.h>
-#include <starpu_parameters.h>
 
 #define NITER	_starpu_calibration_minimum
 

+ 0 - 1
src/core/disk_ops/disk_stdio.c

@@ -28,7 +28,6 @@
 #include <datawizard/copy_driver.h>
 #include <datawizard/memory_manager.h>
 #include <datawizard/memory_nodes.h>
-#include <starpu_parameters.h>
 
 #ifdef STARPU_HAVE_WINDOWS
 #  include <io.h>

+ 0 - 1
src/core/disk_ops/unistd/disk_unistd_global.c

@@ -37,7 +37,6 @@
 #include <datawizard/copy_driver.h>
 #include <datawizard/data_request.h>
 #include <datawizard/memory_manager.h>
-#include <starpu_parameters.h>
 #include <common/uthash.h>
 
 #ifdef STARPU_HAVE_WINDOWS

+ 2 - 12
src/core/perfmodel/perfmodel.c

@@ -126,18 +126,8 @@ double starpu_worker_get_relative_speedup(struct starpu_perfmodel_arch* perf_arc
 	int dev;
 	for(dev = 0; dev < perf_arch->ndevices; dev++)
 	{
-		double coef = 0.0;
-		if (perf_arch->devices[dev].type == STARPU_CPU_WORKER)
-			coef = _STARPU_CPU_ALPHA;
-		else if (perf_arch->devices[dev].type == STARPU_CUDA_WORKER)
-			coef = _STARPU_CUDA_ALPHA;
-		else if (perf_arch->devices[dev].type == STARPU_OPENCL_WORKER)
-			coef = _STARPU_OPENCL_ALPHA;
-		else if (perf_arch->devices[dev].type == STARPU_MIC_WORKER)
-			coef = _STARPU_MIC_ALPHA;
-		else if (perf_arch->devices[dev].type == STARPU_MPI_MS_WORKER)
-			coef = _STARPU_MPI_MS_ALPHA;
-
+		enum starpu_worker_archtype archtype = perf_arch->devices[dev].type;
+		double coef = starpu_driver_info[archtype].alpha;
 		speedup += coef * (perf_arch->devices[dev].ncores);
 	}
 	return speedup;

+ 8 - 34
src/core/perfmodel/perfmodel_history.c

@@ -33,7 +33,6 @@
 #include <core/perfmodel/regression.h>
 #include <core/perfmodel/multiple_regression.h>
 #include <common/config.h>
-#include <starpu_parameters.h>
 #include <common/uthash.h>
 #include <limits.h>
 #include <core/task.h>
@@ -1030,16 +1029,9 @@ void starpu_perfmodel_dump_xml(FILE *f, struct starpu_perfmodel *model)
 		fprintf(f, "  <combination>\n");
 		for(dev = 0; dev < ndevices; dev++)
 		{
-			const char *type;
-			switch (arch_combs[comb]->devices[dev].type)
-			{
-				case STARPU_CPU_WORKER: type = "CPU"; break;
-				case STARPU_CUDA_WORKER: type = "CUDA"; break;
-				case STARPU_OPENCL_WORKER: type = "OpenCL"; break;
-				case STARPU_MIC_WORKER: type = "MIC"; break;
-				case STARPU_MPI_MS_WORKER: type = "MPI_MS"; break;
-				default: STARPU_ASSERT(0);
-			}
+			enum starpu_worker_archtype archtype = arch_combs[comb]->devices[dev].type;
+			const char *type = starpu_driver_info[archtype].name_upper;
+			STARPU_ASSERT(type);
 			fprintf(f, "    <device type=\"%s\" id=\"%d\"",
 					type,
 					arch_combs[comb]->devices[dev].devid);
@@ -1546,29 +1538,11 @@ int starpu_perfmodel_deinit(struct starpu_perfmodel *model){
 	return 0;
 }
 
-char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype)
+const char* starpu_perfmodel_get_archtype_name(enum starpu_worker_archtype archtype)
 {
-	switch(archtype)
-	{
-		case(STARPU_CPU_WORKER):
-			return "cpu";
-			break;
-		case(STARPU_CUDA_WORKER):
-			return "cuda";
-			break;
-		case(STARPU_OPENCL_WORKER):
-			return "opencl";
-			break;
-		case(STARPU_MIC_WORKER):
-			return "mic";
-			break;
-		case(STARPU_MPI_MS_WORKER):
-			return "mpi_ms";
-			break;
-		default:
-			STARPU_ABORT();
-			break;
-	}
+	const char *name = starpu_driver_info[archtype].name_lower;
+	STARPU_ASSERT(name);
+	return name;
 }
 
 void starpu_perfmodel_get_arch_name(struct starpu_perfmodel_arch* arch, char *archname, size_t maxlen,unsigned impl)
@@ -2104,7 +2078,7 @@ int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model)
 		fprintf(output, "\tComb %d: %d device%s\n", model->state->combs[comb], arch->ndevices, arch->ndevices>1?"s":"");
 		for(device=0 ; device<arch->ndevices ; device++)
 		{
-			char *name = starpu_perfmodel_get_archtype_name(arch->devices[device].type);
+			const char *name = starpu_perfmodel_get_archtype_name(arch->devices[device].type);
 			fprintf(output, "\t\tDevice %d: type: %s - devid: %d - ncores: %d\n", device, name, arch->devices[device].devid, arch->devices[device].ncores);
 		}
 	}

+ 37 - 19
src/core/workers.c

@@ -44,6 +44,9 @@
 #include <drivers/cpu/driver_cpu.h>
 #include <drivers/cuda/driver_cuda.h>
 #include <drivers/opencl/driver_opencl.h>
+#include <drivers/mic/driver_mic_source.h>
+#include <drivers/mpi/driver_mpi_source.h>
+#include <drivers/disk/driver_disk.h>
 
 #ifdef STARPU_SIMGRID
 #include <core/simgrid.h>
@@ -202,6 +205,20 @@ void _starpu__workers_c__register_kobs(void)
 	/* TODO */
 }
 
+struct starpu_driver_info starpu_driver_info[STARPU_MAX_WORKER+1];
+
+void starpu_driver_info_register(enum starpu_worker_archtype archtype, const struct starpu_driver_info *info)
+{
+	starpu_driver_info[archtype] = *info;
+}
+
+struct starpu_memory_driver_info starpu_memory_driver_info[STARPU_MAX_RAM+1];
+
+void starpu_memory_driver_info_register(enum starpu_node_kind kind, const struct starpu_memory_driver_info *info)
+{
+	starpu_memory_driver_info[kind] = *info;
+}
+
 /* Initialize value of static argc and argv, called when the process begins
  */
 void _starpu_set_argc_argv(int *argc_param, char ***argv_param)
@@ -1383,6 +1400,15 @@ int _starpu_get_catch_signals(void)
 	return _starpu_config.conf.catch_signals;
 }
 
+void starpu_drivers_preinit(void) {
+	_starpu_cpu_preinit();
+	_starpu_cuda_preinit();
+	_starpu_opencl_preinit();
+	_starpu_mic_preinit();
+	_starpu_mpi_ms_preinit();
+	_starpu_disk_preinit();
+}
+
 int starpu_init(struct starpu_conf *user_conf)
 {
 	return starpu_initialize(user_conf, NULL, NULL);
@@ -1567,6 +1593,9 @@ int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
 
 	_starpu_load_bus_performance_files();
 
+	/* Let drivers register themselves */
+	starpu_drivers_preinit();
+
 	/* Note: nothing before here should be allocating anything, in case we
 	 * actually return ENODEV here */
 
@@ -2567,28 +2596,17 @@ unsigned starpu_worker_get_sched_ctx_list(int workerid, unsigned **sched_ctxs)
 
 const char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
 {
-	switch (type) {
-		case STARPU_CPU_WORKER: return "STARPU_CPU_WORKER";
-		case STARPU_CUDA_WORKER: return "STARPU_CUDA_WORKER";
-		case STARPU_OPENCL_WORKER: return "STARPU_OPENCL_WORKER";
-		case STARPU_MIC_WORKER: return "STARPU_MIC_WORKER";
-		case STARPU_MPI_MS_WORKER: return "STARPU_MPI_MS_WORKER";
-		case STARPU_ANY_WORKER: return "STARPU_ANY_WORKER";
-		default: return "STARPU_unknown_WORKER";
-	}
+	const char *ret = starpu_driver_info[type].name_upper;
+	if (!ret)
+		ret = "unknown";
+	return ret;
 }
 
-const char *starpu_worker_get_type_as_short_string(enum starpu_worker_archtype type)
+const char *starpu_worker_get_type_as_env_var(enum starpu_worker_archtype type)
 {
-	switch (type) {
-		case STARPU_CPU_WORKER: return "CPU";
-		case STARPU_CUDA_WORKER: return "CUDA";
-		case STARPU_OPENCL_WORKER: return "OPENCL";
-		case STARPU_MIC_WORKER: return "MIC";
-		case STARPU_MPI_MS_WORKER: return "MPI_MS";
-		case STARPU_ANY_WORKER: return "ANY";
-		default: return "STARPU_unknown_WORKER";
-	}
+	const char *ret = starpu_driver_info[type].name_var;
+	STARPU_ASSERT(ret);
+	return ret;
 }
 
 void _starpu_worker_set_stream_ctx(unsigned workerid, struct _starpu_sched_ctx *sched_ctx)

+ 25 - 2
src/core/workers.h

@@ -59,8 +59,6 @@
 
 #include <datawizard/datawizard.h>
 
-#include <starpu_parameters.h>
-
 #define STARPU_MAX_PIPELINE 4
 
 enum initialization { UNINITIALIZED = 0, CHANGING, INITIALIZED };
@@ -450,6 +448,31 @@ struct _starpu_machine_config
 	int perf_counter_pause_depth;
 };
 
+/** Provides information for a device driver */
+struct starpu_driver_info {
+	const char *name_upper;	/**< Name of worker type in upper case */
+	const char *name_var;	/**< Name of worker type for environment variables */
+	const char *name_lower;	/**< Name of worker type in lower case */
+	enum starpu_node_kind memory_kind;	/**< Kind of memory in device */
+	double alpha;	/**< Typical relative speed compared to a CPU core */
+};
+
+/** Device driver information, indexed by enum starpu_worker_archtype */
+extern struct starpu_driver_info starpu_driver_info[STARPU_MAX_WORKER+1];
+
+void starpu_driver_info_register(enum starpu_worker_archtype archtype, const struct starpu_driver_info *info);
+
+/** Provides information for a memory node driver */
+struct starpu_memory_driver_info {
+	const char *name_upper;	/**< Name of memory in upper case */
+	enum starpu_worker_archtype worker_archtype;	/**< Kind of device */
+};
+
+/** Memory driver information, indexed by enum starpu_node_kind */
+extern struct starpu_memory_driver_info starpu_memory_driver_info[STARPU_MAX_RAM+1];
+
+void starpu_memory_driver_info_register(enum starpu_node_kind kind, const struct starpu_memory_driver_info *info);
+
 extern int _starpu_worker_parallel_blocks;
 
 extern struct _starpu_machine_config _starpu_config STARPU_ATTRIBUTE_INTERNAL;

+ 3 - 10
src/datawizard/memory_nodes.c

@@ -181,14 +181,7 @@ int starpu_memory_node_get_devid(unsigned node)
 }
 
 enum starpu_worker_archtype starpu_memory_node_get_worker_archtype(enum starpu_node_kind node_kind) {
-	switch (node_kind) {
-		// case STARPU_UNUSED:
-		case STARPU_CPU_RAM: return STARPU_CPU_WORKER;
-		case STARPU_CUDA_RAM: return STARPU_CUDA_WORKER;
-		case STARPU_OPENCL_RAM: return STARPU_OPENCL_WORKER;
-		// case STARPU_DISK_RAM:
-		case STARPU_MIC_RAM: return STARPU_MIC_WORKER;
-		case STARPU_MPI_MS_RAM: return STARPU_MPI_MS_WORKER;
-		default: STARPU_ASSERT_MSG(0, "ambiguous memory node kind %d", node_kind);
-	}
+	enum starpu_worker_archtype archtype = starpu_memory_driver_info[node_kind].worker_archtype;
+	STARPU_ASSERT_MSG(archtype != (enum starpu_worker_archtype) -1, "ambiguous memory node kind %d", node_kind);
+	return archtype;
 }

+ 3 - 19
src/datawizard/node_ops.c

@@ -28,23 +28,7 @@
 
 const char* _starpu_node_get_prefix(enum starpu_node_kind kind)
 {
-	switch (kind)
-	{
-		case STARPU_CPU_RAM:
-			return "NUMA";
-		case STARPU_CUDA_RAM:
-			return "CUDA";
-		case STARPU_OPENCL_RAM:
-			return "OpenCL";
-		case STARPU_DISK_RAM:
-			return "Disk";
-		case STARPU_MIC_RAM:
-			return "MIC";
-		case STARPU_MPI_MS_RAM:
-			return "MPI_MS";
-		case STARPU_UNUSED:
-		default:
-			STARPU_ASSERT(0);
-			return "unknown";
-	}
+	const char *ret = starpu_memory_driver_info[kind].name_upper;
+	STARPU_ASSERT(ret);
+	return ret;
 }

+ 19 - 0
src/drivers/cpu/driver_cpu.c

@@ -59,6 +59,25 @@
 #include <windows.h>
 #endif
 
+static struct starpu_driver_info driver_info = {
+	.name_upper = "CPU",
+	.name_var = "CPU",
+	.name_lower = "cpu",
+	.memory_kind = STARPU_CPU_RAM,
+	.alpha = 0.5f,
+};
+
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "NUMA",
+	.worker_archtype = STARPU_CPU_WORKER,
+};
+
+void _starpu_cpu_preinit(void)
+{
+	starpu_driver_info_register(STARPU_CPU_WORKER, &driver_info);
+	starpu_memory_driver_info_register(STARPU_CPU_RAM, &memory_driver_info);
+}
+
 
 #ifdef STARPU_USE_CPU
 /* Actually launch the job on a cpu worker.

+ 2 - 0
src/drivers/cpu/driver_cpu.h

@@ -22,6 +22,8 @@
 #include <common/config.h>
 #include <datawizard/node_ops.h>
 
+void _starpu_cpu_preinit(void);
+
 extern struct _starpu_driver_ops _starpu_driver_cpu_ops;
 extern struct _starpu_node_ops _starpu_driver_cpu_node_ops;
 

+ 2 - 0
src/drivers/cuda/driver_cuda.h

@@ -22,6 +22,8 @@
 
 #include <common/config.h>
 
+void _starpu_cuda_preinit(void);
+
 #ifdef STARPU_USE_CUDA
 #include <cuda.h>
 #include <cuda_runtime_api.h>

+ 37 - 0
src/drivers/cuda/driver_cuda_init.c

@@ -0,0 +1,37 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <core/workers.h>
+#include <drivers/cuda/driver_cuda.h>
+
+static struct starpu_driver_info driver_info = {
+	.name_upper = "CUDA",
+	.name_var = "CUDA",
+	.name_lower = "cuda",
+	.memory_kind = STARPU_CUDA_RAM,
+	.alpha = 13.33f,
+};
+
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "CUDA",
+	.worker_archtype = STARPU_CUDA_WORKER,
+};
+
+void _starpu_cuda_preinit(void)
+{
+	starpu_driver_info_register(STARPU_CUDA_WORKER, &driver_info);
+	starpu_memory_driver_info_register(STARPU_CUDA_RAM, &memory_driver_info);
+}

+ 10 - 0
src/drivers/disk/driver_disk.c

@@ -23,6 +23,16 @@
 #include <datawizard/coherency.h>
 #include <datawizard/memory_nodes.h>
 
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "Disk",
+	.worker_archtype = (enum starpu_worker_archtype) -1,
+};
+
+void _starpu_disk_preinit(void)
+{
+	starpu_memory_driver_info_register(STARPU_DISK_RAM, &memory_driver_info);
+}
+
 int _starpu_disk_copy_src_to_disk(void * src, unsigned src_node, void * dst, size_t dst_offset, unsigned dst_node, size_t size, void * async_channel)
 {
 	STARPU_ASSERT(starpu_node_get_kind(src_node) == STARPU_CPU_RAM);

+ 2 - 0
src/drivers/disk/driver_disk.h

@@ -22,6 +22,8 @@
 
 #include <datawizard/node_ops.h>
 
+void _starpu_disk_preinit(void);
+
 int _starpu_disk_copy_src_to_disk(void * src, unsigned src_node, void * dst, size_t dst_offset, unsigned dst_node, size_t size, void * async_channel);
 
 int _starpu_disk_copy_disk_to_src(void * src, size_t src_offset, unsigned src_node, void * dst, unsigned dst_node, size_t size, void * async_channel);

+ 19 - 15
src/starpu_parameters.h

@@ -1,7 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011-2020  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
- * Copyright (C) 2013       Thibaut Lambert
+ * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * 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
@@ -15,19 +14,24 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#ifndef _STARPU_PARAMETERS_H
-#define _STARPU_PARAMETERS_H
+#include <core/workers.h>
+#include <drivers/mic/driver_mic_source.h>
 
-/** @file */
+static struct starpu_driver_info driver_info = {
+	.name_upper = "MIC",
+	.name_var = "MIC",
+	.name_lower = "mic",
+	.memory_kind = STARPU_MIC_RAM,
+	.alpha = 0.5f,
+};
 
-/* Parameters which are not worth being added to ./configure options, but
- * still interesting to easily change */
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "MIC",
+	.worker_archtype = STARPU_MIC_WORKER,
+};
 
-/* Assumed relative performance ratios */
-/* TODO: benchmark a bit instead */
-#define _STARPU_CPU_ALPHA	1.0f
-#define _STARPU_CUDA_ALPHA	13.33f
-#define _STARPU_OPENCL_ALPHA	12.22f
-#define _STARPU_MIC_ALPHA	0.5f
-#define _STARPU_MPI_MS_ALPHA	1.0f
-#endif /* _STARPU_PARAMETERS_H */
+void _starpu_mic_preinit(void)
+{
+	starpu_driver_info_register(STARPU_MIC_WORKER, &driver_info);
+	starpu_memory_driver_info_register(STARPU_MIC_RAM, &memory_driver_info);
+}

+ 2 - 0
src/drivers/mic/driver_mic_source.h

@@ -23,6 +23,8 @@
 #include <starpu_mic.h>
 #include <common/config.h>
 
+void _starpu_mic_preinit(void);
+
 #ifdef STARPU_USE_MIC
 
 #include <source/COIProcess_source.h>

+ 37 - 0
src/drivers/mpi/driver_mpi_init.c

@@ -0,0 +1,37 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <core/workers.h>
+#include <drivers/mpi/driver_mpi_source.h>
+
+static struct starpu_driver_info driver_info = {
+	.name_upper = "MPI_MS",
+	.name_var = "MPI_MS",
+	.name_lower = "mpi_ms",
+	.memory_kind = STARPU_MPI_MS_RAM,
+	.alpha = 1.0f,
+};
+
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "MPI_MS",
+	.worker_archtype = STARPU_MPI_MS_WORKER,
+};
+
+void _starpu_mpi_ms_preinit(void)
+{
+	starpu_driver_info_register(STARPU_MPI_MS_WORKER, &driver_info);
+	starpu_memory_driver_info_register(STARPU_MPI_MS_RAM, &memory_driver_info);
+}

+ 2 - 1
src/drivers/mpi/driver_mpi_source.h

@@ -23,8 +23,9 @@
 #include <starpu_mpi_ms.h>
 #include <datawizard/node_ops.h>
 
-#ifdef STARPU_USE_MPI_MASTER_SLAVE
+void _starpu_mpi_ms_preinit(void);
 
+#ifdef STARPU_USE_MPI_MASTER_SLAVE
 extern struct _starpu_node_ops _starpu_driver_mpi_node_ops;
 
 /** Array of structures containing all the informations useful to send

+ 2 - 0
src/drivers/opencl/driver_opencl.h

@@ -36,6 +36,8 @@
 #include <core/workers.h>
 #include <datawizard/node_ops.h>
 
+void _starpu_opencl_preinit(void);
+
 #if defined(STARPU_USE_OPENCL) || defined(STARPU_SIMGRID)
 struct _starpu_machine_config;
 void _starpu_opencl_discover_devices(struct _starpu_machine_config *config);

+ 37 - 0
src/drivers/opencl/driver_opencl_init.c

@@ -0,0 +1,37 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <core/workers.h>
+#include <drivers/opencl/driver_opencl.h>
+
+static struct starpu_driver_info driver_info = {
+	.name_upper = "OpenCL",
+	.name_var = "OPENCL",
+	.name_lower = "opencl",
+	.memory_kind = STARPU_OPENCL_RAM,
+	.alpha = 12.22f,
+};
+
+static struct starpu_memory_driver_info memory_driver_info = {
+	.name_upper = "OpenCL",
+	.worker_archtype = STARPU_OPENCL_WORKER,
+};
+
+void _starpu_opencl_preinit(void)
+{
+	starpu_driver_info_register(STARPU_OPENCL_WORKER, &driver_info);
+	starpu_memory_driver_info_register(STARPU_OPENCL_RAM, &memory_driver_info);
+}

+ 0 - 1
src/sched_policies/parallel_heft.c

@@ -22,7 +22,6 @@
 #include <limits.h>
 #include <core/workers.h>
 #include <core/perfmodel/perfmodel.h>
-#include <starpu_parameters.h>
 #include <core/detect_combined_workers.h>
 #include <core/sched_policy.h>
 #include <core/task.h>

+ 0 - 4
tools/dev/checker/rename_internal.sed

@@ -123,10 +123,6 @@ s/\bSTARPU_TRACE_WORK_STEALING\b/_STARPU_TRACE_WORK_STEALING/g
 #s/\bSTARPU_DEFAULT_BETA\b/_STARPU_DEFAULT_BETA/g
 #s/\bSTARPU_DEFAULT_GAMMA\b/_STARPU_DEFAULT_GAMMA/g
 #s/\bSTARPU_CALIBRATION_MINIMUM\b/_STARPU_CALIBRATION_MINIMUM/g
-#s/\bSTARPU_CPU_ALPHA\b/_STARPU_CPU_ALPHA/g
-#s/\bSTARPU_CUDA_ALPHA\b/_STARPU_CUDA_ALPHA/g
-#s/\bSTARPU_OPENCL_ALPHA\b/_STARPU_OPENCL_ALPHA/g
-#s/\bSTARPU_GORDON_ALPHA\b/_STARPU_GORDON_ALPHA/g
 #
 #s/\bstarpu_memory_node_to_devid\b/_starpu_memory_node_to_devid/g
 #s/\bstarpu_memchunk_recently_used\b/_starpu_memchunk_recently_used/g

+ 1 - 0
tools/starpu_perfmodel_display.c

@@ -156,6 +156,7 @@ int main(int argc, char **argv)
 #endif
 
 	parse_args(argc, argv);
+	starpu_drivers_preinit();
 	starpu_perfmodel_initialize();
 
         if (plist)

+ 1 - 0
tools/starpu_perfmodel_plot.c

@@ -555,6 +555,7 @@ int main(int argc, char **argv)
 #endif
 
 	parse_args(argc, argv, &options, &directory);
+	starpu_drivers_preinit();
 	starpu_perfmodel_initialize();
 
 	if (options.directory)