Nathalie Furmento лет назад: 7
Родитель
Сommit
c022938b0e

+ 2 - 0
ChangeLog

@@ -59,6 +59,8 @@ Small features:
   * New function starpu_mpi_comm_get_attr() which allows to return the
     value of the attribute STARPU_MPI_TAG_UB, i.e the upper bound for
     tag value.
+  * New configure option enable-mpi-verbose to manage the display of
+    extra MPI debug messages.
 
 Changes:
   * Vastly improve simgrid simulation time.

+ 13 - 0
configure.ac

@@ -625,6 +625,19 @@ AC_ARG_WITH(mpiexec-args, [AS_HELP_STRING([--with-mpiexec-args[=<arguments to gi
 AC_SUBST(MPIEXEC_ARGS,$mpiexec_args)
 
 
+AC_MSG_CHECKING(whether MPI debug messages should be displayed)
+AC_ARG_ENABLE(mpi-verbose, [AS_HELP_STRING([--enable-mpi-verbose],
+			[display MPI verbose debug messages (--enable-mpi-verbose=extra increase the verbosity)])],
+			enable_mpi_verbose=$enableval, enable_mpi_verbose=no)
+AC_MSG_RESULT($enable_mpi_verbose)
+if test x$enable_mpi_verbose = xyes; then
+	AC_DEFINE(STARPU_MPI_VERBOSE, [1], [display MPI verbose debug messages])
+fi
+if test x$enable_mpi_verbose = xextra; then
+	AC_DEFINE(STARPU_MPI_VERBOSE, [1], [display MPI verbose debug messages])
+	AC_DEFINE(STARPU_MPI_EXTRA_VERBOSE, [1], [display MPI verbose debug messages])
+fi
+
 ###############################################################################
 #                                                                             #
 #                           MIC device compilation                            #

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

@@ -382,6 +382,19 @@ Enable the MPI Master-Slave support. By default, it is disabled.
 Create one thread per MPI Slave on the MPI master to manage communications.
 </dd>
 
+<dt>--enable-mpi-verbose</dt>
+<dd>
+\anchor enable-mpi-verbose
+\addindex __configure__--enable-mpi-verbose
+Increase the verbosity of the MPI debugging messages.  This can be disabled
+at runtime by setting the environment variable \ref STARPU_SILENT to
+any value. <c>--enable-mpi-verbose=extra</c> increase even more the verbosity.
+
+\verbatim
+$ STARPU_SILENT=1 mpirun -np 2 ./insert_task
+\endverbatim
+</dd>
+
 <dt>--disable-fortran</dt>
 <dd>
 \anchor disable-fortran

+ 1 - 0
include/starpu_config.h.in

@@ -40,6 +40,7 @@
 #undef STARPU_OPENMP
 
 #undef STARPU_SIMGRID
+#undef STARPU_SIMGRID_MC
 #undef STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT
 #undef STARPU_HAVE_SIMGRID_MSG_H
 #undef STARPU_HAVE_XBT_SYNCHRO_H

+ 2 - 2
mpi/src/load_balancer/policy/load_heat_propagation.c

@@ -289,12 +289,12 @@ static void update_data_ranks()
 				//        fprintf(stderr,"Bring back data %p (tag %d) from node %d on node %d\n", handle, (data_movements_get_tags_table(data_movements_handles[i]))[j], starpu_mpi_data_get_rank(handle), my_rank);
 				//}
 
-				_STARPU_DEBUG("Call of starpu_mpi_get_data_on_node(%ld,%d) on node %d\n", starpu_mpi_data_get_tag(handle), dst_rank, my_rank);
+				_STARPU_DEBUG("Call of starpu_mpi_get_data_on_node(%"PRIi64"d,%d) on node %d\n", starpu_mpi_data_get_tag(handle), dst_rank, my_rank);
 
 				/* Migrate the data handle */
 				starpu_mpi_get_data_on_node_detached(MPI_COMM_WORLD, handle, dst_rank, NULL, NULL);
 
-				_STARPU_DEBUG("New rank (%d) of data %ld upgraded on node %d\n", dst_rank, starpu_mpi_data_get_tag(handle), my_rank);
+				_STARPU_DEBUG("New rank (%d) of data %"PRIi64"d upgraded on node %d\n", dst_rank, starpu_mpi_data_get_tag(handle), my_rank);
 				starpu_mpi_data_set_rank_comm(handle, dst_rank, MPI_COMM_WORLD);
 			}
 		}

+ 21 - 20
mpi/src/mpi/starpu_mpi_mpi.c

@@ -208,7 +208,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 
 	_STARPU_MPI_INC_POSTED_REQUESTS(-1);
 
-	_STARPU_MPI_DEBUG(3, "new req %p srcdst %d tag %ld and type %s %d\n", req, req->node_tag.rank, req->node_tag.data_tag, _starpu_mpi_request_type(req->request_type), req->is_internal_req);
+	_STARPU_MPI_DEBUG(0, "new req %p srcdst %d tag %"PRIi64"d and type %s %d\n", req, req->node_tag.rank, req->node_tag.data_tag, _starpu_mpi_request_type(req->request_type), req->is_internal_req);
 
 	STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 
@@ -234,7 +234,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 				_STARPU_MPI_MALLOC(req->ptr, req->count);
 			}
 
-			_STARPU_MPI_DEBUG(3, "Pushing internal starpu_mpi_irecv request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
+			_STARPU_MPI_DEBUG(3, "Pushing internal starpu_mpi_irecv request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
 					  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr,
 					  req->datatype_name, (int)req->count, req->registered_datatype);
 			_starpu_mpi_req_list_push_front(&ready_recv_requests, req);
@@ -266,7 +266,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 				STARPU_PTHREAD_MUTEX_UNLOCK(&(early_data_handle->req_mutex));
 				STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 
-				_STARPU_MPI_DEBUG(3, "The RECV request %p with tag %ld has already been received, copying previously received data into handle's pointer..\n", req, req->node_tag.data_tag);
+				_STARPU_MPI_DEBUG(3, "The RECV request %p with tag %"PRIi64"d has already been received, copying previously received data into handle's pointer..\n", req, req->node_tag.data_tag);
 				STARPU_ASSERT(req->data_handle != early_data_handle->handle);
 
 				req->internal_req = early_data_handle->req;
@@ -288,7 +288,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 			else
 			{
 				struct _starpu_mpi_req *sync_req = _starpu_mpi_sync_data_find(req->node_tag.data_tag, req->node_tag.rank, req->node_tag.comm);
-				_STARPU_MPI_DEBUG(3, "----------> Looking for sync data for tag %ld and src %d = %p\n", req->node_tag.data_tag, req->node_tag.rank, sync_req);
+				_STARPU_MPI_DEBUG(3, "----------> Looking for sync data for tag %"PRIi64"d and src %d = %p\n", req->node_tag.data_tag, req->node_tag.rank, sync_req);
 				if (sync_req)
 				{
 					req->sync = 1;
@@ -310,7 +310,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 				}
 				else
 				{
-					_STARPU_MPI_DEBUG(3, "Adding the pending receive request %p (srcdst %d tag %ld) into the request hashmap\n", req, req->node_tag.rank, req->node_tag.data_tag);
+					_STARPU_MPI_DEBUG(3, "Adding the pending receive request %p (srcdst %d tag %"PRIi64"d) into the request hashmap\n", req, req->node_tag.rank, req->node_tag.data_tag);
 					_starpu_mpi_early_request_enqueue(req);
 				}
 			}
@@ -323,7 +323,7 @@ static void _starpu_mpi_submit_ready_request(void *arg)
 		else
 			_starpu_mpi_req_list_push_front(&ready_recv_requests, req);
 		_STARPU_MPI_INC_READY_REQUESTS(+1);
-		_STARPU_MPI_DEBUG(3, "Pushing new request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
+		_STARPU_MPI_DEBUG(3, "Pushing new request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
 				  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr,
 				  req->datatype_name, (int)req->count, req->registered_datatype);
 	}
@@ -453,7 +453,7 @@ static void _starpu_mpi_isend_data_func(struct _starpu_mpi_req *req)
 {
 	_STARPU_MPI_LOG_IN();
 
-	_STARPU_MPI_DEBUG(30, "post MPI isend request %p type %s tag %ld src %d data %p datasize %ld ptr %p datatype '%s' count %d registered_datatype %d sync %d\n", req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, starpu_data_get_size(req->data_handle), req->ptr, req->datatype_name, (int)req->count, req->registered_datatype, req->sync);
+	_STARPU_MPI_DEBUG(0, "post MPI isend request %p type %s tag %"PRIi64"d src %d data %p datasize %ld ptr %p datatype '%s' count %d registered_datatype %d sync %d\n", req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, starpu_data_get_size(req->data_handle), req->ptr, req->datatype_name, (int)req->count, req->registered_datatype, req->sync);
 
 	_starpu_mpi_comm_amounts_inc(req->node_tag.comm, req->node_tag.rank, req->datatype, req->count);
 
@@ -567,7 +567,7 @@ void _starpu_mpi_irecv_size_func(struct _starpu_mpi_req *req)
 {
 	_STARPU_MPI_LOG_IN();
 
-	_STARPU_MPI_DEBUG(20, "post MPI irecv request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n", req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr, req->datatype_name, (int)req->count, req->registered_datatype);
+	_STARPU_MPI_DEBUG(0, "post MPI irecv request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n", req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr, req->datatype_name, (int)req->count, req->registered_datatype);
 
 	_STARPU_MPI_TRACE_IRECV_SUBMIT_BEGIN(req->node_tag.rank, req->node_tag.data_tag);
 
@@ -700,7 +700,7 @@ void _starpu_mpi_test_func(struct _starpu_mpi_req *testing_req)
 	/* Which is the mpi request we are testing for ? */
 	struct _starpu_mpi_req *req = testing_req->other_request;
 
-	_STARPU_MPI_DEBUG(2, "Test request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
+	_STARPU_MPI_DEBUG(0, "Test request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
 			  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr,
 			  req->datatype_name, (int)req->count, req->registered_datatype);
 
@@ -889,7 +889,7 @@ static void _starpu_mpi_handle_request_termination(struct _starpu_mpi_req *req)
 {
 	_STARPU_MPI_LOG_IN();
 
-	_STARPU_MPI_DEBUG(2, "complete MPI request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d internal_req %p\n",
+	_STARPU_MPI_DEBUG(2, "complete MPI request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d internal_req %p\n",
 			  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle, req->ptr,
 			  req->datatype_name, (int)req->count, req->registered_datatype, req->internal_req);
 
@@ -1054,7 +1054,7 @@ static void _starpu_mpi_test_detached_requests(void)
 		STARPU_PTHREAD_MUTEX_UNLOCK(&detached_requests_mutex);
 
 		_STARPU_MPI_TRACE_TEST_BEGIN(req->node_tag.rank, req->node_tag.data_tag);
-		//_STARPU_MPI_DEBUG(3, "Test detached request %p - mpitag %d - TYPE %s %d\n", &req->data_request, req->node_tag.data_tag, _starpu_mpi_request_type(req->request_type), req->node_tag.rank);
+		//_STARPU_MPI_DEBUG(3, "Test detached request %p - mpitag %"PRIi64"d - TYPE %s %d\n", &req->data_request, req->node_tag.data_tag, _starpu_mpi_request_type(req->request_type), req->node_tag.rank);
 #ifdef STARPU_SIMGRID
 		req->ret = _starpu_mpi_simgrid_mpi_test(&req->done, &flag);
 #else
@@ -1138,7 +1138,7 @@ static void _starpu_mpi_handle_ready_request(struct _starpu_mpi_req *req)
 	STARPU_MPI_ASSERT_MSG(req, "Invalid request");
 
 	/* submit the request to MPI */
-	_STARPU_MPI_DEBUG(2, "Handling new request %p type %s tag %ld src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
+	_STARPU_MPI_DEBUG(2, "Handling new request %p type %s tag %"PRIi64"d src %d data %p ptr %p datatype '%s' count %d registered_datatype %d \n",
 			  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.rank, req->data_handle,
 			  req->ptr, req->datatype_name, (int)req->count, req->registered_datatype);
 	req->func(req);
@@ -1148,7 +1148,7 @@ static void _starpu_mpi_handle_ready_request(struct _starpu_mpi_req *req)
 
 static void _starpu_mpi_receive_early_data(struct _starpu_mpi_envelope *envelope, MPI_Status status, MPI_Comm comm)
 {
-	_STARPU_MPI_DEBUG(20, "Request with tag %ld and source %d not found, creating a early_data_handle to receive incoming data..\n", envelope->data_tag, status.MPI_SOURCE);
+	_STARPU_MPI_DEBUG(20, "Request with tag %"PRIi64"d and source %d not found, creating a early_data_handle to receive incoming data..\n", envelope->data_tag, status.MPI_SOURCE);
 	_STARPU_MPI_DEBUG(20, "Request sync %d\n", envelope->sync);
 
 	struct _starpu_mpi_early_data_handle* early_data_handle = _starpu_mpi_early_data_create(envelope, status.MPI_SOURCE, comm);
@@ -1178,7 +1178,7 @@ static void _starpu_mpi_receive_early_data(struct _starpu_mpi_envelope *envelope
 		//_starpu_mpi_early_data_add(early_data_handle);
 	}
 
-	_STARPU_MPI_DEBUG(20, "Posting internal detached irecv on early_data_handle with tag %ld from comm %ld src %d ..\n",
+	_STARPU_MPI_DEBUG(20, "Posting internal detached irecv on early_data_handle with tag %"PRIi64"d from comm %ld src %d ..\n",
 			  early_data_handle->node_tag.data_tag, (long int)comm, status.MPI_SOURCE);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 	early_data_handle->req = _starpu_mpi_irecv_common(early_data_handle->handle, status.MPI_SOURCE,
@@ -1383,15 +1383,16 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 				if (envelope->mode == _STARPU_MPI_ENVELOPE_SYNC_READY)
 				{
 					struct _starpu_mpi_req *_sync_req = _starpu_mpi_sync_data_find(envelope->data_tag, envelope_status.MPI_SOURCE, envelope_comm);
-					_STARPU_MPI_DEBUG(20, "Sending data with tag %d to node %d\n", _sync_req->node_tag.data_tag, envelope_status.MPI_SOURCE);
-					STARPU_MPI_ASSERT_MSG(envelope->data_tag == _sync_req->node_tag.data_tag, "Tag mismatch (envelope %ld != req %ld)\n", envelope->data_tag, _sync_req->node_tag.data_tag);
+					_STARPU_MPI_DEBUG(20, "Sending data with tag %"PRIi64" to node %d\n", _sync_req->node_tag.data_tag, envelope_status.MPI_SOURCE);
+					STARPU_MPI_ASSERT_MSG(envelope->data_tag == _sync_req->node_tag.data_tag, "Tag mismatch (envelope %"PRIi64"d != req %"PRIi64"d)\n",
+							      envelope->data_tag, _sync_req->node_tag.data_tag);
 					STARPU_PTHREAD_MUTEX_UNLOCK(&progress_mutex);
 					_starpu_mpi_isend_data_func(_sync_req);
 					STARPU_PTHREAD_MUTEX_LOCK(&progress_mutex);
 				}
 				else
 				{
-					_STARPU_MPI_DEBUG(3, "Searching for application request with tag %ld and source %d (size %ld)\n", envelope->data_tag, envelope_status.MPI_SOURCE, envelope->size);
+					_STARPU_MPI_DEBUG(3, "Searching for application request with tag %"PRIi64"d and source %d (size %ld)\n", envelope->data_tag, envelope_status.MPI_SOURCE, envelope->size);
 
 					struct _starpu_mpi_req *early_request = _starpu_mpi_early_request_dequeue(envelope->data_tag, envelope_status.MPI_SOURCE, envelope_comm);
 
@@ -1404,7 +1405,7 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 					{
 						if (envelope->sync)
 						{
-							_STARPU_MPI_DEBUG(2000, "-------------------------> adding request for tag %ld\n", envelope->data_tag);
+							_STARPU_MPI_DEBUG(2000, "-------------------------> adding request for tag %l"PRIi64"\n", envelope->data_tag);
 							struct _starpu_mpi_req *new_req;
 #ifdef STARPU_DEVEL
 #warning creating a request is not really useful.
@@ -1438,7 +1439,7 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 					 * _starpu_mpi_handle_ready_request. */
 					else
 					{
-						_STARPU_MPI_DEBUG(2000, "A matching application request has been found for the incoming data with tag %ld\n", envelope->data_tag);
+						_STARPU_MPI_DEBUG(2000, "A matching application request has been found for the incoming data with tag %"PRIi64"d\n", envelope->data_tag);
 						_STARPU_MPI_DEBUG(2000, "Request sync %d\n", envelope->sync);
 
 						early_request->sync = envelope->sync;
@@ -1513,7 +1514,7 @@ static void *_starpu_mpi_progress_thread_func(void *arg)
 
 	if (argc_argv->initialize_mpi)
 	{
-		_STARPU_MPI_DEBUG(3, "Calling MPI_Finalize()\n");
+		_STARPU_MPI_DEBUG(0, "Calling MPI_Finalize()\n");
 		MPI_Finalize();
 	}
 

+ 3 - 3
mpi/src/mpi/starpu_mpi_tag.c

@@ -89,7 +89,7 @@ void _starpu_mpi_tag_data_register(starpu_data_handle_t handle, int64_t data_tag
 	STARPU_ASSERT_MSG(!(_starpu_mpi_tag_get_data_handle_from_tag(data_tag)),
 			  "There is already a data handle %p registered with the tag %ld\n", _starpu_mpi_tag_get_data_handle_from_tag(data_tag), data_tag);
 
-	_STARPU_MPI_DEBUG(42, "Adding handle %p with tag %ld in hashtable\n", handle, data_tag);
+	_STARPU_MPI_DEBUG(42, "Adding handle %p with tag %"PRIi64"d in hashtable\n", handle, data_tag);
 
 	entry->handle = handle;
 	entry->data_tag = data_tag;
@@ -103,7 +103,7 @@ int _starpu_mpi_tag_data_release(starpu_data_handle_t handle)
 {
 	int64_t data_tag = starpu_mpi_data_get_tag(handle);
 
-	_STARPU_MPI_DEBUG(42, "Removing handle %p with tag %ld from hashtable\n", handle, data_tag);
+	_STARPU_MPI_DEBUG(42, "Removing handle %p with tag %"PRIi64"d from hashtable\n", handle, data_tag);
 
 	if (data_tag != -1)
 	{
@@ -111,7 +111,7 @@ int _starpu_mpi_tag_data_release(starpu_data_handle_t handle)
 
 		_starpu_spin_lock(&registered_tag_handles_lock);
 		HASH_FIND_INT(registered_tag_handles, &(((struct _starpu_mpi_data *)(handle->mpi_data))->node_tag.data_tag), tag_entry);
-		STARPU_ASSERT_MSG((tag_entry != NULL),"Data handle %p with tag %ld isn't in the hashmap !", handle, data_tag);
+		STARPU_ASSERT_MSG((tag_entry != NULL),"Data handle %p with tag %"PRIi64"d isn't in the hashmap !", handle, data_tag);
 
 		HASH_DEL(registered_tag_handles, tag_entry);
 

+ 3 - 3
mpi/src/starpu_mpi_private.h

@@ -57,7 +57,7 @@ extern int _starpu_debug_rank;
 char *_starpu_mpi_get_mpi_error_code(int code);
 extern int _starpu_mpi_comm_debug;
 
-#ifdef STARPU_VERBOSE
+#ifdef STARPU_MPI_VERBOSE
 extern int _starpu_debug_level_min;
 extern int _starpu_debug_level_max;
 void _starpu_mpi_set_debug_level_min(int level);
@@ -99,7 +99,7 @@ int _starpu_debug_rank;
 #define _STARPU_MPI_CALLOC(ptr, nmemb, size) do { ptr = calloc(nmemb, size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) (nmemb*size)); } while (0)
 #define _STARPU_MPI_REALLOC(ptr, size) do { void *_new_ptr = realloc(ptr, size); STARPU_MPI_ASSERT_MSG(_new_ptr != NULL, "Cannot reallocate %ld bytes\n", (long) size); ptr = _new_ptr; } while (0)
 
-#ifdef STARPU_VERBOSE
+#ifdef STARPU_MPI_VERBOSE
 #  define _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, node, tag, utag, comm, way) \
 	do								\
 	{							\
@@ -143,7 +143,7 @@ int _starpu_debug_rank;
                                              fprintf(stderr, "[%d][starpu_mpi][%s:%d] " fmt , _starpu_debug_rank, __starpu_func__ , __LINE__ ,## __VA_ARGS__); \
                                              fflush(stderr); } while(0);
 
-#ifdef xSTARPU_VERBOSE
+#ifdef STARPU_MPI_EXTRA_VERBOSE
 #  define _STARPU_MPI_LOG_IN()             do { if (!_starpu_silent) { \
                                                if (_starpu_debug_rank == -1) starpu_mpi_comm_rank(MPI_COMM_WORLD, &_starpu_debug_rank);                        \
                                                fprintf(stderr, "%*s[%d][starpu_mpi][%s:%d] -->\n", (_starpu_debug_rank+1)*4, "", _starpu_debug_rank, __starpu_func__ , __LINE__); \

+ 2 - 1
mpi/tests/attr.c

@@ -16,6 +16,7 @@
 
 #include <starpu_mpi.h>
 #include "helper.h"
+#include <inttypes.h>
 
 int main(int argc, char **argv)
 {
@@ -31,7 +32,7 @@ int main(int argc, char **argv)
 	starpu_mpi_comm_get_attr(MPI_COMM_WORLD, STARPU_MPI_TAG_UB, &value, &flag);
 	STARPU_ASSERT_MSG(flag == 1, "starpu_mpi_comm_get_attr was called with valid argument\n");
 
-	FPRINTF(stderr, "Value: %ld\n", value);
+	FPRINTF(stderr, "Value: %"PRIi64"d\n", value);
 
 	return 0;
 }

+ 2 - 1
src/common/utils.c

@@ -305,7 +305,8 @@ char *_starpu_mktemp_many(const char *directory, int depth, int flags, int *fd)
 		return NULL;
 	}
 	retpath = _starpu_mktemp(path, flags, fd);
-	if (!retpath) {
+	if (!retpath)
+	{
 		/* That failed, drop our directories */
 		_starpu_rmdir_many(path, depth);
 	}

+ 6 - 0
src/common/utils.h

@@ -96,6 +96,12 @@
 #endif
 
 #ifdef STARPU_EXTRA_VERBOSE
+#  define _STARPU_EXTRA_DEBUG(fmt, ...) do { if (!_starpu_silent) {fprintf(stderr, STARPU_DEBUG_PREFIX"[%s] " fmt ,__starpu_func__ ,## __VA_ARGS__); fflush(stderr); }} while(0)
+#else
+#  define _STARPU_EXTRA_DEBUG(fmt, ...) do { } while (0)
+#endif
+
+#ifdef STARPU_EXTRA_VERBOSE
 #  define _STARPU_LOG_IN()             do { if (!_starpu_silent) {fprintf(stderr, STARPU_DEBUG_PREFIX"[%ld][%s:%s@%d] -->\n", starpu_pthread_self(), __starpu_func__,__FILE__,  __LINE__); }} while(0)
 #  define _STARPU_LOG_OUT()            do { if (!_starpu_silent) {fprintf(stderr, STARPU_DEBUG_PREFIX"[%ld][%s:%s@%d] <--\n", starpu_pthread_self(), __starpu_func__, __FILE__,  __LINE__); }} while(0)
 #  define _STARPU_LOG_OUT_TAG(outtag)  do { if (!_starpu_silent) {fprintf(stderr, STARPU_DEBUG_PREFIX"[%ld][%s:%s@%d] <-- (%s)\n", starpu_pthread_self(), __starpu_func__, __FILE__, __LINE__, outtag); }} while(0)

+ 4 - 2
src/core/perfmodel/perfmodel_history.c

@@ -1357,8 +1357,10 @@ int starpu_perfmodel_unload_model(struct starpu_perfmodel *model)
 	struct _starpu_perfmodel *node;
 	for (node  = _starpu_perfmodel_list_begin(&registered_models);
 	     node != _starpu_perfmodel_list_end(&registered_models);
-	     node  = _starpu_perfmodel_list_next(node)) {
-		if (node->model == model) {
+	     node  = _starpu_perfmodel_list_next(node))
+	{
+		if (node->model == model)
+		{
 			_starpu_perfmodel_list_erase(&registered_models, node);
 			_starpu_perfmodel_delete(node);
 			break;

+ 25 - 21
src/core/sched_ctx.c

@@ -1199,13 +1199,13 @@ static void _defer_ctx_change(int sched_ctx_id, enum _starpu_ctx_change_op op, i
 	chg->op = op;
 	STARPU_ASSERT(workerids_to_change != NULL);
 	chg->nworkers_to_change = nworkers_to_change;
-	chg->workerids_to_change = malloc(nworkers_to_change * sizeof(chg->workerids_to_change[0]));
+	_STARPU_MALLOC(chg->workerids_to_change, nworkers_to_change * sizeof(chg->workerids_to_change[0]));
 	memcpy(chg->workerids_to_change, workerids_to_change, nworkers_to_change * sizeof(chg->workerids_to_change[0]));
 	if (nworkers_to_notify != 0)
 	{
 		STARPU_ASSERT(workerids_to_notify != NULL);
 		chg->nworkers_to_notify = nworkers_to_notify;
-		chg->workerids_to_notify = malloc(nworkers_to_notify * sizeof(chg->workerids_to_notify[0]));
+		_STARPU_MALLOC(chg->workerids_to_notify, nworkers_to_notify * sizeof(chg->workerids_to_notify[0]));
 		memcpy(chg->workerids_to_notify, workerids_to_notify, nworkers_to_notify * sizeof(chg->workerids_to_notify[0]));
 	}
 	else
@@ -2089,28 +2089,32 @@ unsigned _starpu_sched_ctx_last_worker_awake(struct _starpu_worker *worker)
 
 		unsigned last_worker_awake = 1;
 		struct starpu_worker_collection *workers = sched_ctx->workers;
-		struct starpu_sched_ctx_iterator it;
-
-		workers->init_iterator(workers, &it);
-		while(workers->has_next(workers, &it))
+		/* workers can be NULL in some corner cases, since we do not lock sched_ctx here */
+		if (workers != NULL)
 		{
-			int workerid = workers->get_next(workers, &it);
-			if(workerid != worker->workerid)
+			struct starpu_sched_ctx_iterator it;
+
+			workers->init_iterator(workers, &it);
+			while(workers->has_next(workers, &it))
 			{
-				/* The worker status is intendedly checked
-				 * without taking locks. If multiple workers
-				 * are concurrently assessing whether they are
-				 * the last worker awake, they will follow the
-				 * pessimistic path and assume that they are
-				 * the last worker awake */
-				STARPU_HG_DISABLE_CHECKING(_starpu_config.workers[workerid].status);
-				const int cond = _starpu_config.workers[workerid].status != STATUS_SLEEPING;
-				STARPU_HG_ENABLE_CHECKING(_starpu_config.workers[workerid].status);
-
-				if (cond)
+				int workerid = workers->get_next(workers, &it);
+				if(workerid != worker->workerid)
 				{
-					last_worker_awake = 0;
-					break;
+					/* The worker status is intendedly checked
+					 * without taking locks. If multiple workers
+					 * are concurrently assessing whether they are
+					 * the last worker awake, they will follow the
+					 * pessimistic path and assume that they are
+					 * the last worker awake */
+					STARPU_HG_DISABLE_CHECKING(_starpu_config.workers[workerid].status);
+					const int cond = _starpu_config.workers[workerid].status != STATUS_SLEEPING;
+					STARPU_HG_ENABLE_CHECKING(_starpu_config.workers[workerid].status);
+
+					if (cond)
+					{
+						last_worker_awake = 0;
+						break;
+					}
 				}
 			}
 		}

+ 2 - 0
src/core/simgrid.c

@@ -1156,6 +1156,7 @@ void _starpu_simgrid_xbt_thread_create(const char *name, void_f_pvoid_t code, vo
 				 );
 }
 
+#if 0
 static size_t used;
 
 void _starpu_simgrid_data_new(size_t size)
@@ -1186,6 +1187,7 @@ void _starpu_simgrid_data_transfer(size_t size, unsigned src_node, unsigned dst_
 {
 	_STARPU_DISP("data transfer %zd from %u to %u\n", size, src_node, dst_node);
 }
+#endif
 
 
 #endif

+ 2 - 1
src/core/task.c

@@ -1248,7 +1248,8 @@ unsigned long starpu_task_get_job_id(struct starpu_task *task)
 
 static starpu_pthread_t watchdog_thread;
 
-static int sleep_some(float timeout) {
+static int sleep_some(float timeout)
+{
 	/* If we do a sleep(timeout), we might have to wait too long at the end of the computation. */
 	/* To avoid that, we do several sleep() of 1s (and check after each if starpu is still running) */
 	float t;

+ 5 - 0
src/datawizard/copy_driver.c

@@ -156,6 +156,9 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 	STARPU_ASSERT(dst_replicate->allocated);
 
 #ifdef STARPU_SIMGRID
+	if (src_node == STARPU_MAIN_RAM || dst_node == STARPU_MAIN_RAM)
+		_starpu_simgrid_data_transfer(handle->ops->get_size(handle), src_node, dst_node);
+
 	return _starpu_simgrid_transfer(handle->ops->get_size(handle), src_node, dst_node, req);
 #else /* !SIMGRID */
 
@@ -559,6 +562,7 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 			}
 			else if (ret == -EAGAIN)
 			{
+				STARPU_ASSERT(req);
 				req->async_channel.event.disk_event.ptr = ptr;
 				req->async_channel.event.disk_event.node = src_node;
 				req->async_channel.event.disk_event.size = size;
@@ -593,6 +597,7 @@ static int copy_data_1_to_1_generic(starpu_data_handle_t handle,
 			}
 			else if (ret == -EAGAIN)
 			{
+				STARPU_ASSERT(req);
 				req->async_channel.event.disk_event.ptr = ptr;
 				req->async_channel.event.disk_event.node = dst_node;
 				req->async_channel.event.disk_event.size = size;

+ 4 - 2
src/datawizard/malloc.c

@@ -306,7 +306,8 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 #endif
 	}
 #ifdef STARPU_HAVE_HWLOC
-	if (starpu_memory_nodes_get_numa_count() > 1) {
+	if (starpu_memory_nodes_get_numa_count() > 1)
+	{
 		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		hwloc_topology_t hwtopology = config->topology.hwtopology;
 		hwloc_obj_t numa_node_obj = hwloc_get_obj_by_type(hwtopology, HWLOC_OBJ_NODE, starpu_memory_nodes_numa_id_to_hwloclogid(dst_node));
@@ -495,7 +496,8 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 #endif
 	}
 #ifdef STARPU_HAVE_HWLOC
-	else if (starpu_memory_nodes_get_numa_count() > 1) {
+	else if (starpu_memory_nodes_get_numa_count() > 1)
+	{
 		struct _starpu_machine_config *config = _starpu_get_machine_config();
 		hwloc_topology_t hwtopology = config->topology.hwtopology;
 		hwloc_free(hwtopology, A, dim);

+ 2 - 1
src/debug/traces/starpu_fxt.c

@@ -618,7 +618,8 @@ static int prefixTOnodeid (const char *prefix)
 	//if we are a single-node trace, prefix is empty, so return 0
 	if (strcmp(prefix, "")==0) return 0;
 
-	char *str = malloc(sizeof(char)*strlen(prefix));
+	char *str;
+	_STARPU_MALLOC(str, sizeof(char)*strlen(prefix));
 	strncpy (str, prefix, strlen(prefix));
 	str[strlen(prefix)-1] = '\0';
 	unsigned long nodeid = atoi(str);

+ 26 - 50
src/drivers/driver_common/driver_common.c

@@ -391,42 +391,31 @@ struct starpu_task *_starpu_get_worker_task(struct _starpu_worker *worker, int w
 		STARPU_PTHREAD_COND_BROADCAST(&worker->sched_cond);
 
 #ifndef STARPU_NON_BLOCKING_DRIVERS
-		int cond_no_keep_awake = !worker->state_keep_awake;
-		int cond_can_block = _starpu_worker_can_block(memnode, worker);
-		int cond_no_last_awake = !_starpu_sched_ctx_last_worker_awake(worker);
-		int cond_no_block_in_parallel_rq = !worker->state_block_in_parallel_req;
-		int cond_no_unblock_in_parallel_rq = !worker->state_unblock_in_parallel_req;
-
-		if (cond_can_block
-			&& cond_no_last_awake
-			&& cond_no_block_in_parallel_rq
-			&& cond_no_unblock_in_parallel_rq)
+		if (_starpu_worker_can_block(memnode, worker)
+			&& !worker->state_block_in_parallel_req
+			&& !worker->state_unblock_in_parallel_req
+			&& !_starpu_sched_ctx_last_worker_awake(worker))
 		{
 			do
 			{
-				//_STARPU_DEBUG("worker %u going to sleep: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
 				STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
-
-				cond_no_keep_awake = !worker->state_keep_awake;
-				cond_can_block = _starpu_worker_can_block(memnode, worker);
-				cond_no_block_in_parallel_rq = !worker->state_block_in_parallel_req;
-				cond_no_unblock_in_parallel_rq = !worker->state_unblock_in_parallel_req;
-				if (cond_no_keep_awake
-					&& cond_can_block
-					&& cond_no_block_in_parallel_rq
-					&& cond_no_unblock_in_parallel_rq)
+				if (!worker->state_keep_awake
+					&& _starpu_worker_can_block(memnode, worker)
+					&& !worker->state_block_in_parallel_req
+					&& !worker->state_unblock_in_parallel_req)
 				{
 					_starpu_worker_set_status_sleeping(workerid);
-					cond_no_last_awake = !_starpu_sched_ctx_last_worker_awake(worker);
+					if (_starpu_sched_ctx_last_worker_awake(worker))
+					{
+						break;
+					}
 				}
 				else
 				{
-					cond_no_last_awake = 0;
 					break;
 				}
 			}
-			while (cond_no_last_awake);
-			//_STARPU_DEBUG("worker %u waking up: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
+			while (1);
 			worker->state_keep_awake = 0;
 			_starpu_worker_set_status_scheduling_done(workerid);
 			STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
@@ -434,7 +423,6 @@ struct starpu_task *_starpu_get_worker_task(struct _starpu_worker *worker, int w
 		else
 #endif
 		{
-			//_STARPU_DEBUG("worker %u wont sleep: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
 			_starpu_worker_set_status_scheduling_done(workerid);
 			STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 			if (_starpu_machine_is_running())
@@ -598,49 +586,37 @@ int _starpu_get_multi_worker_task(struct _starpu_worker *workers, struct starpu_
 		_starpu_worker_set_status_sleeping(workerid);
 		_starpu_worker_leave_sched_op(worker);
 
-		int cond_no_keep_awake = 1;
-		int cond_can_block = _starpu_worker_can_block(memnode, worker);
-		int cond_no_last_awake = !_starpu_sched_ctx_last_worker_awake(worker);
-		int cond_no_block_in_parallel_rq = !worker->state_block_in_parallel_req;
-		int cond_no_unblock_in_parallel_rq = !worker->state_unblock_in_parallel_req;
-
-		if (cond_can_block
-			&& cond_no_last_awake
-			&& cond_no_block_in_parallel_rq
-			&& cond_no_unblock_in_parallel_rq)
+		if (_starpu_worker_can_block(memnode, worker)
+			&& !worker->state_block_in_parallel_req
+			&& !worker->state_unblock_in_parallel_req
+			&& !_starpu_sched_ctx_last_worker_awake(worker))
 		{
 			do
 			{
-				//_STARPU_DEBUG("worker %u going to sleep: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
 				STARPU_PTHREAD_COND_WAIT(&worker->sched_cond, &worker->sched_mutex);
-
-				cond_no_keep_awake = !worker->state_keep_awake;
-				cond_can_block = _starpu_worker_can_block(memnode, worker);
-				cond_no_block_in_parallel_rq = !worker->state_block_in_parallel_req;
-				cond_no_unblock_in_parallel_rq = !worker->state_unblock_in_parallel_req;
-				if (cond_no_keep_awake
-					&& cond_can_block
-					&& cond_no_block_in_parallel_rq
-					&& cond_no_unblock_in_parallel_rq)
+				if (!worker->state_keep_awake
+					&& _starpu_worker_can_block(memnode, worker)
+					&& !worker->state_block_in_parallel_req
+					&& !worker->state_unblock_in_parallel_req)
 				{
 					_starpu_worker_set_status_sleeping(workerid);
-					cond_no_last_awake = !_starpu_sched_ctx_last_worker_awake(worker);
+					if (_starpu_sched_ctx_last_worker_awake(worker))
+					{
+						break;
+					}
 				}
 				else
 				{
-					cond_no_last_awake = 0;
 					break;
 				}
 			}
-			while (cond_no_last_awake);
-			//_STARPU_DEBUG("worker %u waking up: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
+			while (1);
 			worker->state_keep_awake = 0;
 			_starpu_worker_set_status_scheduling_done(workerid);
 			STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 		}
 		else
 		{
-			//_STARPU_DEBUG("worker %u wont sleep: %d|%d|%d|%d|%d\n", worker->workerid, cond_no_keep_awake, cond_can_block, cond_no_last_awake, cond_no_block_in_parallel_rq, cond_no_unblock_in_parallel_rq);
 			_starpu_worker_set_status_scheduling_done(workerid);
 			STARPU_PTHREAD_MUTEX_UNLOCK_SCHED(&worker->sched_mutex);
 			if (_starpu_machine_is_running())

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

@@ -169,9 +169,7 @@ char *_starpu_opencl_load_program_source(const char *filename)
 	}
 	source[x] = '\0';
 
-#ifdef STARPU_EXTRA_VERBOSE
-	_STARPU_DEBUG("OpenCL kernel <%s>\n", source);
-#endif
+	_STARPU_EXTRA_DEBUG("OpenCL kernel <%s>\n", source);
 
 	fclose(fh);
 

+ 18 - 16
src/sched_policies/component_prio.c

@@ -124,7 +124,7 @@ static int prio_push_local_task(struct starpu_sched_component * component, struc
 	else
 		exp_len = prio->exp_len;
 
-	if((data->ntasks_threshold != 0) && (data->exp_len_threshold != 0.0) && 
+	if((data->ntasks_threshold != 0) && (data->exp_len_threshold != 0.0) &&
 			((prio->ntasks >= data->ntasks_threshold) || (exp_len >= data->exp_len_threshold)))
 	{
 		static int warned;
@@ -146,15 +146,16 @@ static int prio_push_local_task(struct starpu_sched_component * component, struc
 			starpu_sched_component_prefetch_on_node(component, task);
 			STARPU_TRACE_SCHED_COMPONENT_PUSH_PRIO(component, prio->ntasks, exp_len);
 		}
-		
-		if(!isnan(task->predicted_transfer)) {
-			double end = prio_estimated_end(component); 
-			double tfer_end = now + task->predicted_transfer; 
-			if(tfer_end < end) 
-				task->predicted_transfer = 0.0; 
-			else 
-				task->predicted_transfer = tfer_end - end; 
-			exp_len += task->predicted_transfer; 
+
+		if(!isnan(task->predicted_transfer))
+		{
+			double end = prio_estimated_end(component);
+			double tfer_end = now + task->predicted_transfer;
+			if(tfer_end < end)
+				task->predicted_transfer = 0.0;
+			else
+				task->predicted_transfer = tfer_end - end;
+			exp_len += task->predicted_transfer;
 		}
 
 		if(!isnan(task->predicted))
@@ -165,7 +166,7 @@ static int prio_push_local_task(struct starpu_sched_component * component, struc
 		STARPU_ASSERT(!isnan(prio->exp_end));
 		STARPU_ASSERT(!isnan(prio->exp_len));
 		STARPU_ASSERT(!isnan(prio->exp_start));
-		
+
 		STARPU_COMPONENT_MUTEX_UNLOCK(mutex);
 		if(!is_pushback)
 			component->can_pull(component);
@@ -206,7 +207,8 @@ static struct starpu_task * prio_pull_task(struct starpu_sched_component * compo
 			}
 		}
 		STARPU_ASSERT_MSG(prio->exp_len>=0, "prio->exp_len=%lf\n",prio->exp_len);
-		if(!isnan(task->predicted_transfer)){
+		if(!isnan(task->predicted_transfer))
+		{
 			if (prio->exp_len > task->predicted_transfer)
 			{
 				prio->exp_start += task->predicted_transfer;
@@ -222,7 +224,7 @@ static struct starpu_task * prio_pull_task(struct starpu_sched_component * compo
 		prio->exp_end = prio->exp_start + prio->exp_len;
 		if(prio->ntasks == 0)
 			prio->exp_len = 0.0;
-		
+
 		STARPU_TRACE_SCHED_COMPONENT_POP_PRIO(component, prio->ntasks, prio->exp_len);
 	}
 	STARPU_ASSERT(!isnan(prio->exp_end));
@@ -233,8 +235,8 @@ static struct starpu_task * prio_pull_task(struct starpu_sched_component * compo
 	// When a pop is called, a can_push is called for pushing tasks onto
 	// the empty place of the queue left by the popped task.
 
-	starpu_sched_component_send_can_push_to_parents(component); 
-	
+	starpu_sched_component_send_can_push_to_parents(component);
+
 	if(task)
 		return task;
 
@@ -252,7 +254,7 @@ static int prio_can_push(struct starpu_sched_component * component)
 	int res = 0;
 	struct starpu_task * task;
 
-	task = starpu_sched_component_pump_downstream(component, &res); 
+	task = starpu_sched_component_pump_downstream(component, &res);
 
 	if(task)
 	{

+ 17 - 17
src/sched_policies/component_sched.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2013, 2017  INRIA
  * Copyright (C) 2013  Simon Archipoff
- * Copyright (C) 2016  CNRS
+ * Copyright (C) 2016, 2017  CNRS
  *
  * 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
@@ -43,7 +43,7 @@ int starpu_sched_component_execute_preds(struct starpu_sched_component * compone
 	int can_execute = 0;
 	starpu_task_bundle_t bundle = task->bundle;
 	double len = DBL_MAX;
-	
+
 
 	int workerid;
 	for(workerid = starpu_bitmap_first(component->workers_in_ctx);
@@ -67,7 +67,6 @@ int starpu_sched_component_execute_preds(struct starpu_sched_component * compone
 				{
 					*length = d;
 					return can_execute;
-						
 				}
 				if(_STARPU_IS_ZERO(d))
 				{
@@ -85,7 +84,7 @@ int starpu_sched_component_execute_preds(struct starpu_sched_component * compone
 	}
 
 	if(len == DBL_MAX) /* we dont have perf model */
-		len = 0.0; 
+		len = 0.0;
 	if(length)
 		*length = len;
 	return can_execute;
@@ -147,7 +146,7 @@ double starpu_sched_component_transfer_length(struct starpu_sched_component * co
 }
 
 /* This function can be called by components when they think that a prefetching request can be submitted.
- * For example, it is currently used by the MCT component to begin the prefetching on accelerators 
+ * For example, it is currently used by the MCT component to begin the prefetching on accelerators
  * on which it pushed tasks as soon as possible.
  */
 void starpu_sched_component_prefetch_on_node(struct starpu_sched_component * component, struct starpu_task * task)
@@ -163,7 +162,7 @@ void starpu_sched_component_prefetch_on_node(struct starpu_sched_component * com
 }
 
 /* remove all child
- * for all child of component, if child->parents[x] == component, set child->parents[x] to null 
+ * for all child of component, if child->parents[x] == component, set child->parents[x] to null
  * call component->deinit_data
  */
 void starpu_sched_component_destroy(struct starpu_sched_component *component)
@@ -234,14 +233,14 @@ void set_properties(struct starpu_sched_component * component)
 	int is_all_same_component = 1;
 	for(;
 	    worker != -1;
-	    worker = starpu_bitmap_next(component->workers_in_ctx, worker))		
+	    worker = starpu_bitmap_next(component->workers_in_ctx, worker))
 	{
 		if(first_worker != _starpu_get_worker_struct(worker)->worker_mask)
 			is_homogeneous = 0;
 		if(first_memory_node != _starpu_get_worker_struct(worker)->memory_node)
 			is_all_same_component = 0;
 	}
-	
+
 
 	if(is_homogeneous)
 		component->properties |= STARPU_SCHED_COMPONENT_HOMOGENEOUS;
@@ -337,7 +336,7 @@ int starpu_sched_tree_push_task(struct starpu_task * task)
 	struct starpu_sched_tree *tree = starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	int ret_val = starpu_sched_component_push_task(NULL, tree->root,task);
-	
+
 	return ret_val;
 }
 
@@ -369,10 +368,10 @@ struct starpu_task * starpu_sched_component_pull_task(struct starpu_sched_compon
 
 /* Pump mechanic to get the task flow rolling. Takes tasks from component and send them to the child.
    To be used by components with only one child */
-struct starpu_task* starpu_sched_component_pump_downstream(struct starpu_sched_component *component, int* success) 
+struct starpu_task* starpu_sched_component_pump_downstream(struct starpu_sched_component *component, int* success)
 {
 	int ret = 0;
-	
+
 	STARPU_ASSERT(component->nchildren == 1);
 	struct starpu_sched_component * child = component->children[0];
 	struct starpu_task * task;
@@ -382,17 +381,17 @@ struct starpu_task* starpu_sched_component_pump_downstream(struct starpu_sched_c
 		task = starpu_sched_component_pull_task(component,component);
 		if (!task)
 			break;
-		ret = starpu_sched_component_push_task(component,child,task);	
+		ret = starpu_sched_component_push_task(component,child,task);
 		if (ret)
 			break;
-		if(success) 
-			* success = 1; 
+		if(success)
+			* success = 1;
 	}
 	if(task && ret)
 		return task;
 
 	return NULL;
-	
+
 }
 
 void starpu_sched_tree_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
@@ -580,7 +579,8 @@ static int starpu_sched_component_can_pull(struct starpu_sched_component * compo
 	STARPU_ASSERT(component);
 	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
 	unsigned i;
-	for(i = 0; i < component->nchildren; i++) {
+	for(i = 0; i < component->nchildren; i++)
+	{
 		if (component->children[i]->can_pull(component->children[i]))
 			return 1;
 	}
@@ -596,7 +596,7 @@ int starpu_sched_component_send_can_push_to_parents(struct starpu_sched_componen
 {
 	STARPU_ASSERT(component);
 	STARPU_ASSERT(!starpu_sched_component_is_worker(component));
-	
+
 	unsigned i;
 	int ret = 0;
 	for(i=0; i < component->nparents; i++)

+ 2 - 1
src/worker_collection/worker_tree.c

@@ -186,7 +186,8 @@ static unsigned tree_has_next(struct starpu_worker_collection *workers, struct s
 	int nworkers;
 	int w;
 
-	if (it->value) {
+	if (it->value)
+	{
 		struct starpu_tree *node = it->value;
 		/* Are there workers left to be processed in the current node? */
 		nworkers = starpu_bindid_get_workerids(node->id, &workerids);

+ 11 - 6
tools/dev/checker/starpu_check_copyright.sh

@@ -17,13 +17,18 @@
 
 REP=${1:-.}
 
-for f in $(find $REP -not -path "*svn*" -not -path "*build*" -not -path "*starpu-top*"  -not -path "*min-dgels*" -not -name ".gitignore"  -not -name "*.doxy"  -not -name "*.eps"  -not -name "*.pdf" -not -name "*.png" -type f)
+find $REP -not -path "*svn*" -not -path "*build*" -not -path "*starpu-top*"  -not -path "*min-dgels*" -not -name ".gitignore"  -not -name "*.doxy"  -not -name "*.eps"  -not -name "*.pdf" -not -name "*.png" -not -path "*.deps*" -type f > /tmp/list_$$
+
+for f in $(cat /tmp/list_$$)
 do
-#    copyright=$(grep "StarPU is free software" $f 2>/dev/null)
-#    if test -z "$copyright"
-#    then
-#	echo "File $f does not include a proper copyright"
-#    fi
+    copyright=$(grep "StarPU is free software" $f 2>/dev/null)
+    if test -z "$copyright"
+    then
+	echo "File $f does not include a proper copyright"
+    fi
+done
 
+for f in $(cat /tmp/list_$$)
+do
     svn log $f | grep '|' | awk -F'|' '{print $2}' | sort | uniq
 done

+ 3 - 3
tools/dev/checker/starpu_check_macros.sh

@@ -17,9 +17,9 @@
 
 dirname=$(dirname $0)
 
-INC_DIRS=$(find $dirname/../../ -name include -type d)
+INC_DIRS=$(find $dirname/../../../ -name include -type d)
 STARPU_H_FILES=$(find $INC_DIRS -name '*.h')
-STARPU_CONFIG=$dirname/../../include/starpu_config.h.in
+STARPU_CONFIG=$dirname/../../../include/starpu_config.h.in
 STARPU_CONFIG_DISPLAY=$(python -c "import os.path; print os.path.relpath('$STARPU_CONFIG', '.')")
 macros1=$(grep 'ifdef' $STARPU_H_FILES|grep STARPU|awk '{print $NF}')
 macros2=$(grep defined $STARPU_H_FILES | tr ' (' '\012' | grep STARPU | sed 's/defined//' | tr -d '()!,')
@@ -28,7 +28,7 @@ macros=$(echo $macros1 $macros2 | tr ' ' '\012' | sort | uniq)
 for m in $macros
 do
     count=$(grep -c $m $STARPU_CONFIG)
-    if test $count -eq 0
+    if test "$count" -eq "0"
     then
 	echo $m missing in $STARPU_CONFIG_DISPLAY
     fi

+ 1 - 1
tools/dev/checker/starpu_check_malloc.sh

@@ -16,7 +16,7 @@
 # See the GNU Lesser General Public License in COPYING.LGPL for more details.
 
 dirname=$(dirname $0)
-cd $dirname/../../
+cd $dirname/../../../
 
 DIRS="src tools mpi/src"
 #sc_hypervisor/src"

+ 2 - 2
tools/dev/checker/starpu_check_register.sh

@@ -4,7 +4,7 @@
 
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
-# Copyright (C) 2011 CNRS
+# Copyright (C) 2011, 2017 CNRS
 # Copyright (C) 2011 INRIA
 #
 # StarPU is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@ filese=$(find examples -type f -not -path "*svn*" -name '*.c')
 filest=$(find tests -type f -not -path "*svn*" -name '*.c')
 
 for file in $filest $filese ; do
-    handles=$(spatch -very_quiet -sp_file tools/dev/starpu_check_register.cocci $file)
+    handles=$(spatch -very_quiet -sp_file tools/dev/checker/starpu_check_register.cocci $file)
     if test "x$handles" != "x" ; then
 	for handle in $handles; do
 	    echo "$handle"

+ 2 - 2
tools/dev/cppcheck/suppressions.txt

@@ -42,8 +42,8 @@ redundantAssignment:tests/main/driver_api/run_driver.c
 unreadVariable:tests/datawizard/variable_size.c
 
 uselessAssignmentPtrArg:mpi/src/starpu_mpi.c:171
-unreadVariable:mpi/src/starpu_mpi.c:996
-unusedVariable:mpi/src/starpu_mpi.c:997
+unreadVariable:mpi/src/starpu_mpi.c:971
+unusedVariable:mpi/src/starpu_mpi.c:972
 redundantAssignment:src/core/workers.c
 
 invalidPointerCast:src/core/perfmodel/perfmodel_nan.c:74

+ 2 - 1
tools/starpu_replay_sched.c

@@ -239,7 +239,8 @@ void schedRecInit(const char * filename)
 	}
 
 	size_t lnsize = 128;
-	char * s = malloc(sizeof(*s) * lnsize);
+	char *s;
+	_STARPU_MALLOC(s, sizeof(*s) * lnsize);
 	int eof = 0;
 
 	reset();