Objet : Developers list for StarPU
Archives de la liste
- From: Cyril Roelandt <cyril.roelandt@inria.fr>
- To: starpu-devel@lists.gforge.inria.fr
- Subject: [Starpu-devel] Seek and destroy memory leaks.
- Date: Wed, 01 Feb 2012 02:18:47 +0100
- List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
- List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>
Hello,
We often have to run Valgrind on our examples and our tests in order to track memory leaks. But Valgrind is quite slow, so it ends up being killed by buildbot after 600 seconds, or running for a very long time (hours ?) in our terminals, which is not very convenient.
I think it is Samuel who suggested that, when running Valgrind, we should skip the computations. It does make sense, since memory leaks probably happen in the core of StarPU, and not in the codelets.
Valgrind provides RUNNING_ON_VALGRIND, which is quite simple to use :
$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <valgrind/valgrind.h>
int
main(void)
{
if (RUNNING_ON_VALGRIND)
(void) fprintf(stdout, "Running on valgrind.\n");
else
(void) fprintf(stdout, "Not running on valgrind.\n");
return EXIT_SUCCESS;
}
$ ./test
Not running on valgrind.
$ valgrind ./test
// blah
Running on valgrind.
// blah
I think we could do something like this :
#if STARPU_HAVE_VALGRIND_H
#define STARPU_SKIP_IF_VALGRIND do { if(RUNNING_ON_VALGRIND) return; } while(0)
#else
#define STARPU_SKIP_IF_VALGRIND 0
#endif
And add STARPU_SKIP_IF_VALGRIND at the beginning of our codelets (which would be easy to do with a tool like Coccinelle) :
#if STARPU_HAVE_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
...
void cpu_func_0(void *buffers[], void *arg)
{
STARPU_SKIP_IF_VALGRIND;
/* Computations */
}
I am afraid that every test will return EXIT_FAILURE, since the result will not be good, but is that really a problem ?
This way, Valgrind should take much less time to execute our tests, and we should be able to find memory leaks easily. Fixing them might be harder :) So, what do you think about this ?
Cyril.
- [Starpu-devel] Seek and destroy memory leaks., Cyril Roelandt, 01/02/2012
- <Suite(s) possible(s)>
- Re: [Starpu-devel] Seek and destroy memory leaks., Samuel Thibault, 01/02/2012
- Re: [Starpu-devel] Seek and destroy memory leaks., Cyril Roelandt, 01/02/2012
- Re: [Starpu-devel] Seek and destroy memory leaks., Nathalie Furmento, 01/02/2012
- Message indisponible
- Re: [Starpu-devel] Seek and destroy memory leaks., Samuel Thibault, 01/02/2012
- Re: [Starpu-devel] Seek and destroy memory leaks., Cyril Roelandt, 01/02/2012
Archives gérées par MHonArc 2.6.19+.