Przeglądaj źródła

The starpu_conf_init initialize a starpu_conf structure with default values.

Cédric Augonnet 14 lat temu
rodzic
commit
6a322b0098
2 zmienionych plików z 23 dodań i 0 usunięć
  1. 3 0
      include/starpu.h
  2. 20 0
      src/core/workers.c

+ 3 - 0
include/starpu.h

@@ -68,6 +68,9 @@ struct starpu_conf {
 	int calibrate;
 };
 
+/* Initialize a starpu_conf structure with default values. */
+int starpu_conf_init(struct starpu_conf *conf);
+
 /* Initialization method: it must be called prior to any other StarPU call
  * Default configuration is used if NULL is passed as argument.
  */

+ 20 - 0
src/core/workers.c

@@ -261,6 +261,26 @@ struct starpu_worker_s *_starpu_get_local_worker_key(void)
 	return pthread_getspecific(worker_key);
 }
 
+/* Initialize the starpu_conf with default values */
+int starpu_conf_init(struct starpu_conf *conf)
+{
+	if (!conf)
+		return -EINVAL;
+
+	conf->sched_policy_name = NULL;
+	conf->sched_policy = NULL;
+	conf->ncpus = -1;
+	conf->ncuda = -1;
+	conf->nopencl = -1;
+	conf->nspus = -1;
+	conf->use_explicit_workers_bindid = 0;
+	conf->use_explicit_workers_cuda_gpuid = 0;
+	conf->use_explicit_workers_opencl_gpuid = 0;
+	conf->calibrate = -1;
+
+	return 0;
+};
+
 int starpu_init(struct starpu_conf *user_conf)
 {
 	int ret;