Browse Source

fix build without valgrind

Samuel Thibault 4 years ago
parent
commit
4034e434b1
3 changed files with 4 additions and 2 deletions
  1. 1 1
      mpi/src/mpi/starpu_mpi_mpi.c
  2. 1 1
      mpi/src/nmad/starpu_mpi_nmad.c
  3. 2 0
      src/common/utils.h

+ 1 - 1
mpi/src/mpi/starpu_mpi_mpi.c

@@ -686,7 +686,7 @@ int _starpu_mpi_test(starpu_mpi_req *public_req, int *flag, MPI_Status *status)
 
 	STARPU_MPI_ASSERT_MSG(!req->detached, "MPI_Test cannot be called on a detached request");
 
-	if (STARPU_RUNNING_ON_VALGRIND) sched_yield();
+	STARPU_VALGRIND_YIELD();
 
 #ifdef STARPU_SIMGRID
 	ret = req->ret = _starpu_mpi_simgrid_mpi_test(&req->done, flag);

+ 1 - 1
mpi/src/nmad/starpu_mpi_nmad.c

@@ -245,7 +245,7 @@ int _starpu_mpi_test(starpu_mpi_req *public_req, int *flag, MPI_Status *status)
 	_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",
 			  req, _starpu_mpi_request_type(req->request_type), req->node_tag.data_tag, req->node_tag.node.rank, req->data_handle, req->ptr, req->datatype_name, (int)req->count, req->registered_datatype);
 
-	if (STARPU_RUNNING_ON_VALGRIND) sched_yield();
+	STARPU_VALGRIND_YIELD();
 
 	_STARPU_MPI_TRACE_UTESTING_BEGIN(req->node_tag.node.rank, req->node_tag.data_tag);
 

+ 2 - 0
src/common/utils.h

@@ -85,8 +85,10 @@
 #define _STARPU_UYIELD() ((void)0)
 #endif
 #if defined(STARPU_HAVE_SCHED_YIELD) && defined(STARPU_HAVE_HELGRIND_H)
+#define STARPU_VALGRIND_YIELD() do { if (STARPU_RUNNING_ON_VALGRIND) sched_yield(); } while (0)
 #define STARPU_UYIELD() do { if (STARPU_RUNNING_ON_VALGRIND) sched_yield(); else _STARPU_UYIELD(); } while (0)
 #else
+#define STARPU_VALGRIND_YIELD() do { } while (0)
 #define STARPU_UYIELD() _STARPU_UYIELD()
 #endif