Samuel Thibault %!s(int64=10) %!d(string=hai) anos
pai
achega
c44e7dffbb

+ 13 - 12
src/common/thread.c

@@ -21,7 +21,7 @@
 
 #ifdef STARPU_SIMGRID
 #include <xbt/synchro_core.h>
-#endif
+#else
 
 #if defined(STARPU_LINUX_SYS) && defined(STARPU_HAVE_XCHG)
 #include <linux/futex.h>
@@ -37,6 +37,7 @@ static int _starpu_futex_wake = FUTEX_WAKE;
 #endif
 
 #endif
+#endif /* !STARPU_SIMGRID */
 
 #ifdef STARPU_SIMGRID
 
@@ -75,22 +76,22 @@ int starpu_pthread_exit(void *retval)
 }
 
 
-int starpu_pthread_attr_init(starpu_pthread_attr_t *attr)
+int starpu_pthread_attr_init(starpu_pthread_attr_t *attr STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_attr_destroy(starpu_pthread_attr_t *attr)
+int starpu_pthread_attr_destroy(starpu_pthread_attr_t *attr STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_attr_setdetachstate(starpu_pthread_attr_t *attr, int detachstate)
+int starpu_pthread_attr_setdetachstate(starpu_pthread_attr_t *attr STARPU_ATTRIBUTE_UNUSED, int detachstate STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_mutex_init(starpu_pthread_mutex_t *mutex, const starpu_pthread_mutexattr_t *mutexattr)
+int starpu_pthread_mutex_init(starpu_pthread_mutex_t *mutex, const starpu_pthread_mutexattr_t *mutexattr STARPU_ATTRIBUTE_UNUSED)
 {
 	*mutex = xbt_mutex_init();
 	return 0;
@@ -144,22 +145,22 @@ int starpu_pthread_mutex_trylock(starpu_pthread_mutex_t *mutex)
 	return ret;
 }
 
-int starpu_pthread_mutexattr_gettype(const starpu_pthread_mutexattr_t *attr, int *type)
+int starpu_pthread_mutexattr_gettype(const starpu_pthread_mutexattr_t *attr STARPU_ATTRIBUTE_UNUSED, int *type STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_mutexattr_settype(starpu_pthread_mutexattr_t *attr, int type)
+int starpu_pthread_mutexattr_settype(starpu_pthread_mutexattr_t *attr STARPU_ATTRIBUTE_UNUSED, int type STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_mutexattr_destroy(starpu_pthread_mutexattr_t *attr)
+int starpu_pthread_mutexattr_destroy(starpu_pthread_mutexattr_t *attr STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
 
-int starpu_pthread_mutexattr_init(starpu_pthread_mutexattr_t *attr)
+int starpu_pthread_mutexattr_init(starpu_pthread_mutexattr_t *attr STARPU_ATTRIBUTE_UNUSED)
 {
 	return 0;
 }
@@ -205,7 +206,7 @@ void* starpu_pthread_getspecific(starpu_pthread_key_t key)
 	return array[key];
 }
 
-int starpu_pthread_cond_init(starpu_pthread_cond_t *cond, starpu_pthread_condattr_t *cond_attr)
+int starpu_pthread_cond_init(starpu_pthread_cond_t *cond, starpu_pthread_condattr_t *cond_attr STARPU_ATTRIBUTE_UNUSED)
 {
 	*cond = xbt_cond_init();
 	return 0;
@@ -247,7 +248,7 @@ int starpu_pthread_cond_destroy(starpu_pthread_cond_t *cond)
 	return 0;
 }
 
-int starpu_pthread_rwlock_init(starpu_pthread_rwlock_t *restrict rwlock, const starpu_pthread_rwlockattr_t *restrict attr)
+int starpu_pthread_rwlock_init(starpu_pthread_rwlock_t *restrict rwlock, const starpu_pthread_rwlockattr_t *restrict attr STARPU_ATTRIBUTE_UNUSED)
 {
 	return starpu_pthread_mutex_init(rwlock, NULL);
 }
@@ -312,7 +313,7 @@ int starpu_pthread_rwlock_unlock(starpu_pthread_rwlock_t *rwlock)
 }
 
 #if defined(STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT)
-int starpu_pthread_barrier_init(starpu_pthread_barrier_t *restrict barrier, const starpu_pthread_barrierattr_t *restrict attr, unsigned count)
+int starpu_pthread_barrier_init(starpu_pthread_barrier_t *restrict barrier, const starpu_pthread_barrierattr_t *restrict attr STARPU_ATTRIBUTE_UNUSED, unsigned count)
 {
 	*barrier = xbt_barrier_init(count);
 	return 0;

+ 6 - 3
src/core/detect_combined_workers.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2014  Université de Bordeaux
+ * Copyright (C) 2010-2015  Université de Bordeaux
  * Copyright (C) 2011, 2012, 2013       Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -232,11 +232,14 @@ static void assign_combinations_without_hwloc(struct starpu_worker_collection* w
 static void find_and_assign_combinations_without_hwloc(int *workerids, int nworkers)
 {
 	int i;
-	unsigned j;
 	unsigned sched_ctx_id  = starpu_sched_ctx_get_context();
 	if(sched_ctx_id == STARPU_NMAX_SCHED_CTXS)
 		sched_ctx_id = 0;
-	int min, max, mic_min, mic_max;
+	int min, max;
+#ifdef STARPU_USE_MIC
+	unsigned j;
+	int mic_min, mic_max;
+#endif
 
 	struct starpu_worker_collection* workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 

+ 11 - 1
src/core/perfmodel/perfmodel_bus.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2014  Université de Bordeaux
+ * Copyright (C) 2009-2015  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
  * Copyright (C) 2013 Corentin Salingue
  *
@@ -66,18 +66,23 @@ struct dev_timing
 static double bandwidth_matrix[STARPU_MAXNODES][STARPU_MAXNODES];
 static double latency_matrix[STARPU_MAXNODES][STARPU_MAXNODES];
 static unsigned was_benchmarked = 0;
+#ifndef STARPU_SIMGRID
 static unsigned ncpus = 0;
+#endif
 static unsigned ncuda = 0;
 static unsigned nopencl = 0;
 static unsigned nmic = 0;
 
 /* Benchmarking the performance of the bus */
 
+#ifndef STARPU_SIMGRID
 static uint64_t cuda_size[STARPU_MAXCUDADEVS];
+#endif
 #ifdef STARPU_USE_CUDA
 /* preference order of cores (logical indexes) */
 static int cuda_affinity_matrix[STARPU_MAXCUDADEVS][STARPU_MAXCPUS];
 
+#ifndef STARPU_SIMGRID
 static double cudadev_timing_htod[STARPU_MAXNODES] = {0.0};
 static double cudadev_latency_htod[STARPU_MAXNODES] = {0.0};
 static double cudadev_timing_dtoh[STARPU_MAXNODES] = {0.0};
@@ -86,17 +91,22 @@ static double cudadev_latency_dtoh[STARPU_MAXNODES] = {0.0};
 static double cudadev_timing_dtod[STARPU_MAXNODES][STARPU_MAXNODES] = {{0.0}};
 static double cudadev_latency_dtod[STARPU_MAXNODES][STARPU_MAXNODES] = {{0.0}};
 #endif
+#endif
 static struct dev_timing cudadev_timing_per_cpu[STARPU_MAXNODES*STARPU_MAXCPUS];
 #endif
 
+#ifndef STARPU_SIMGRID
 static uint64_t opencl_size[STARPU_MAXCUDADEVS];
+#endif
 #ifdef STARPU_USE_OPENCL
 /* preference order of cores (logical indexes) */
 static int opencl_affinity_matrix[STARPU_MAXOPENCLDEVS][STARPU_MAXCPUS];
+#ifndef STARPU_SIMGRID
 static double opencldev_timing_htod[STARPU_MAXNODES] = {0.0};
 static double opencldev_latency_htod[STARPU_MAXNODES] = {0.0};
 static double opencldev_timing_dtoh[STARPU_MAXNODES] = {0.0};
 static double opencldev_latency_dtoh[STARPU_MAXNODES] = {0.0};
+#endif
 static struct dev_timing opencldev_timing_per_cpu[STARPU_MAXNODES*STARPU_MAXCPUS];
 #endif
 

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

@@ -221,6 +221,7 @@ static void insert_history_entry(struct starpu_perfmodel_history_entry *entry, s
 	HASH_ADD_UINT32_T(*history_ptr, footprint, table);
 }
 
+#ifndef STARPU_SIMGRID
 static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, int impl)
 {
 	struct starpu_perfmodel_per_arch *per_arch_model;
@@ -259,6 +260,7 @@ static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, in
 	fprintf(f, "# a\t\tb\t\tc\n");
 	fprintf(f, "%-15le\t%-15le\t%-15le\n", a, b, c);
 }
+#endif
 
 static void scan_reg_model(FILE *f, struct starpu_perfmodel_regression_model *reg_model)
 {
@@ -301,10 +303,12 @@ static void scan_reg_model(FILE *f, struct starpu_perfmodel_regression_model *re
 	reg_model->nl_valid = !nl_invalid && VALID_REGRESSION(reg_model);
 }
 
+#ifndef STARPU_SIMGRID
 static void dump_history_entry(FILE *f, struct starpu_perfmodel_history_entry *entry)
 {
 	fprintf(f, "%08x\t%-15lu\t%-15le\t%-15le\t%-15le\t%-15le\t%-15le\t%u\n", entry->footprint, (unsigned long) entry->size, entry->flops, entry->mean, entry->deviation, entry->sum, entry->sum2, entry->nsample);
 }
+#endif
 
 static void scan_history_entry(FILE *f, struct starpu_perfmodel_history_entry *entry)
 {
@@ -526,6 +530,7 @@ static void parse_model_file(FILE *f, struct starpu_perfmodel *model, unsigned s
 		parse_comb(f, model, scan_history, comb);
 }
 
+#ifndef STARPU_SIMGRID
 static void dump_per_arch_model_file(FILE *f, struct starpu_perfmodel *model, int comb, unsigned impl)
 {
 	struct starpu_perfmodel_per_arch *per_arch_model;
@@ -621,6 +626,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 		}
 	}
 }
+#endif
 
 void _starpu_perfmodel_realloc(struct starpu_perfmodel *model, int nb)
 {
@@ -731,6 +737,7 @@ static void get_model_path(struct starpu_perfmodel *model, char *path, size_t ma
 	}
 }
 
+#ifndef STARPU_SIMGRID
 static void save_history_based_model(struct starpu_perfmodel *model)
 {
 	STARPU_ASSERT(model);
@@ -756,6 +763,7 @@ static void save_history_based_model(struct starpu_perfmodel *model)
 
 	fclose(f);
 }
+#endif
 
 static void _starpu_dump_registered_models(void)
 {

+ 3 - 3
src/core/sched_ctx.c

@@ -1757,13 +1757,13 @@ unsigned _starpu_sched_ctx_last_worker_awake(struct _starpu_worker *worker)
 
 void starpu_sched_ctx_bind_current_thread_to_cpuid(unsigned cpuid STARPU_ATTRIBUTE_UNUSED)
 {
+#ifdef STARPU_SIMGRID
+	return;
+#else
 	struct _starpu_machine_config *config = _starpu_get_machine_config();
 
 	/* FIXME: why not factorize with _starpu_bind_thread_on_cpu? */
 
-#ifdef STARPU_SIMGRID
-	return;
-#else
 	if (starpu_get_env_number("STARPU_WORKERS_NOBIND") > 0)
 		return;
 

+ 1 - 0
src/core/simgrid.h

@@ -41,6 +41,7 @@ int _starpu_simgrid_transfer(size_t size, unsigned src_node, unsigned dst_node,
 int _starpu_simgrid_get_nbhosts(const char *prefix);
 unsigned long long _starpu_simgrid_get_memsize(const char *prefix, unsigned devid);
 msg_host_t _starpu_simgrid_get_host_by_name(const char *name);
+struct _starpu_worker;
 msg_host_t _starpu_simgrid_get_host_by_worker(struct _starpu_worker *worker);
 void _starpu_simgrid_get_platform_path(char *path, size_t maxlen);
 msg_as_t _starpu_simgrid_get_as_by_name(const char *name);

+ 8 - 0
src/core/topology.c

@@ -1248,18 +1248,24 @@ _starpu_init_workers_binding (struct _starpu_machine_config *config, int no_mp_c
 #if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
 	unsigned cuda_init[STARPU_MAXCUDADEVS] = { };
 	unsigned cuda_memory_nodes[STARPU_MAXCUDADEVS];
+#ifndef STARPU_SIMGRID
 	unsigned cuda_bindid[STARPU_MAXCUDADEVS];
 #endif
+#endif
 #if defined(STARPU_USE_OPENCL) || defined(STARPU_SIMGRID)
 	unsigned opencl_init[STARPU_MAXOPENCLDEVS] = { };
 	unsigned opencl_memory_nodes[STARPU_MAXOPENCLDEVS];
+#ifndef STARPU_SIMGRID
 	unsigned opencl_bindid[STARPU_MAXOPENCLDEVS];
 #endif
+#endif
 #ifdef STARPU_USE_MIC
 	unsigned mic_init[STARPU_MAXMICDEVS] = { };
 	unsigned mic_memory_nodes[STARPU_MAXMICDEVS];
+#ifndef STARPU_SIGMRID
 	unsigned mic_bindid[STARPU_MAXMICDEVS];
 #endif
+#endif
 
 	unsigned worker;
 	for (worker = 0; worker < config->topology.nworkers; worker++)
@@ -1268,9 +1274,11 @@ _starpu_init_workers_binding (struct _starpu_machine_config *config, int no_mp_c
 		struct _starpu_worker *workerarg = &config->workers[worker];
 		unsigned devid = workerarg->devid;
 
+#ifndef STARPU_SIMGRID
 		/* Perhaps the worker has some "favourite" bindings  */
 		int *preferred_binding = NULL;
 		int npreferred = 0;
+#endif
 
 		/* select the memory node that contains worker's memory */
 		switch (workerarg->arch)

+ 5 - 1
src/datawizard/malloc.c

@@ -226,7 +226,9 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 				ret = -ENOMEM;
 		}
 
+#ifndef STARPU_SIMGRID
 end:
+#endif
 	if (ret == 0)
 	{
 		STARPU_ASSERT_MSG(*A, "Failed to allocated memory of size %ld b\n", dim);
@@ -358,7 +360,9 @@ int starpu_free_flags(void *A, size_t dim, int flags)
 	} else
 	free(A);
 
+#ifndef STARPU_SIMGRID
 out:
+#endif
 	if (flags & STARPU_MALLOC_COUNT)
 	{
 		starpu_memory_deallocate(STARPU_MAIN_RAM, dim);
@@ -382,7 +386,7 @@ _starpu_malloc_on_node(unsigned dst_node, size_t size)
 {
 	uintptr_t addr = 0;
 
-#ifdef STARPU_USE_CUDA
+#if defined(STARPU_USE_CUDA) && !defined(STARPU_SIMGRID)
 	cudaError_t status;
 #endif
 

+ 4 - 0
src/drivers/driver_common/driver_common.c

@@ -468,7 +468,9 @@ int _starpu_get_multi_worker_task(struct _starpu_worker *workers, struct starpu_
 	struct _starpu_job * j;
 	int is_parallel_task;
 	struct _starpu_combined_worker *combined_worker;
+#ifndef STARPU_NON_BLOCKING_DRIVERS
 	int executing = 0;
+#endif
 	/*for each worker*/
 #ifndef STARPU_NON_BLOCKING_DRIVERS
 	/* This assumes only 1 worker */
@@ -477,10 +479,12 @@ int _starpu_get_multi_worker_task(struct _starpu_worker *workers, struct starpu_
 #endif
 	for (i = 0; i < nworkers; i++)
 	{
+#ifndef STARPU_NON_BLOCKING_DRIVERS
 		if ((workers[i].pipeline_length == 0 && workers[i].current_task)
 			|| (workers[i].pipeline_length != 0 && workers[i].ntasks))
 			/* At least this worker is executing something */
 			executing = 1;
+#endif
 		/*if the worker is already executing a task then */
 		if((workers[i].pipeline_length == 0 && workers[i].current_task)
 			|| (workers[i].pipeline_length != 0 &&

+ 3 - 1
src/drivers/opencl/driver_opencl.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2014  Université de Bordeaux
+ * Copyright (C) 2010-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
@@ -678,8 +678,10 @@ int _starpu_opencl_driver_run_once(struct _starpu_worker *worker)
 
 	if (worker->ntasks)
 	{
+#ifndef STARPU_SIMGRID
 		size_t size;
 		int err;
+#endif
 
 		/* On-going asynchronous task, check for its termination first */