Browse Source

Add STARPU_DISABLE_PINNING environment variable, to be able to disable memory pinning for Valgrind

Samuel Thibault 11 years ago
parent
commit
143aa5f194

+ 12 - 2
doc/doxygen/chapters/11debugging_tools.doxy

@@ -10,14 +10,24 @@
 
 StarPU provides several tools to help debugging applications. Execution traces
 can be generated and displayed graphically, see \ref
-GeneratingTracesWithFxT. Some gdb helpers are also provided to show
-the whole StarPU state:
+GeneratingTracesWithFxT.
+
+Some gdb helpers are also provided to show the whole StarPU state:
 
 \verbatim
 (gdb) source tools/gdbinit
 (gdb) help starpu
 \endverbatim
 
+Valgrind can be used on StarPU: valgrind.h just needs to be found at ./configure
+time, to tell valgrind about some known false positives. When working with GPUs,
+memory pinning should be disabled with
+
+export STARPU_DISABLE_PINNING=1
+
+otherwise valgrind will not properly catch errors about data allocated through
+starpu_malloc and friends.
+
 The Temanejo task debugger can also be used, see \ref UsingTheTemanejoTaskDebugger.
 
 \section UsingTheTemanejoTaskDebugger Using The Temanejo Task Debugger

+ 9 - 0
doc/doxygen/chapters/40environment_variables.doxy

@@ -262,6 +262,15 @@ through RAM. The default is Enabled.
 This permits to test the performance effect of GPU-Direct.
 </dd>
 
+<dt>STARPU_DISABLE_PINNING</dt>
+<dd>
+\anchor STARPU_DISABLE_PINNING
+\addindex __env__STARPU_DISABLE_PINNING
+Disable (1) or Enable (0) pinning host memory allocated through starpu_malloc
+and friends.  The default is Enabled.
+This permits to test the performance effect of memory pinning.
+</dd>
+
 </dl>
 
 \section ConfiguringTheSchedulingEngine Configuring The Scheduling Engine

+ 2 - 2
src/datawizard/malloc.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2010, 2012-2013  Université de Bordeaux 1
+ * Copyright (C) 2009-2010, 2012-2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -109,7 +109,7 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
 		}
 	}
 
-	if (flags & STARPU_MALLOC_PINNED)
+	if (flags & STARPU_MALLOC_PINNED && starpu_get_env_number("STARPU_DISABLE_PINNING") <= 0)
 	{
 #ifdef STARPU_SIMGRID
 		/* FIXME: CUDA seems to be taking 650µs every 1MiB.