[CMake] CTest for memory check of parallel (mpi) tests

Olivier Pierard olivier.pierard at cenaero.be
Thu Mar 25 11:30:36 EDT 2010


Dear all,

I'm wondering how to configure CTest to run a memory analysis with
valgrind for parallel tests (distributed memory - MPI).

Context is the following:
- CMake/CTest 2.8.0
- Parallel execution of test is given in CMakeLists:
    add_test(${TName} ${submit_test_command} ${submit_test_args}
             ${TEST_INPUT_FILE})
    where:
        - TName is test name
        - submit_test_command is mpirun
        - submit_test_args is e.g.: '-np 4 executable_name'
        - TEST_INPUT_FILE is the data_filename
- In ctest script launched with ctest -S:
    - set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
    - set(CTEST_MEMORYCHECK_COMMAND_OPTIONS
            "--log-file=vlogs --leak-check=full --xml=yes")
    - In CTEST_COMMAND, there is a 'qsub -sync y submit_ctest_nightly.job'
- In submit_ctest_nightly.job':
    - SGE configuration commands + 'ctest -D NightlyMemoryCheck'

Problem is that the final command call should be of the form:
mpirun -np 4 ${set(CTEST_MEMORYCHECK_COMMAND}
${set(CTEST_MEMORYCHECK_COMMAND_OPTIONS} executable_name ${TEST_INPUT_FILE}

and not:
${set(CTEST_MEMORYCHECK_COMMAND}
${set(CTEST_MEMORYCHECK_COMMAND_OPTIONS} mpirun -np 4 executable_name
${TEST_INPUT_FILE}

Is this feasible ?

Thank you very much for your help,

Olivier



More information about the CMake mailing list