diff --git a/src/slurmd/common/slurmstepd_init.h b/src/slurmd/common/slurmstepd_init.h index 53191521da921153cde7a206844102424dcc4dad..0d800979c3ca6b52f6aefa7ee4ec3ec7c77c8ca4 100644 --- a/src/slurmd/common/slurmstepd_init.h +++ b/src/slurmd/common/slurmstepd_init.h @@ -51,7 +51,8 @@ /* If you want to run memory checks on slurmstepd switch this comment */ #define SLURMSTEPD_MEMCHECK 0 /* Run slurmstepd without memory checks */ //#define SLURMSTEPD_MEMCHECK 1 /* Run slurmstepd with memcheck */ -//#define SLURMSTEPD_MEMCHECK 2 /* Run slurmstepd with valgrind */ +//#define SLURMSTEPD_MEMCHECK 2 /* Run slurmstepd with valgrind/memcheck */ +//#define SLURMSTEPD_MEMCHECK 3 /* Run slurmstepd with valgrind/drd */ typedef enum slurmd_step_tupe { LAUNCH_BATCH_JOB = 0, diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c index f6d482c404e550dd0a562545d2fdbe54c8328e54..ad2ce40b76a72530daecd141a19bca1abb6fc8a6 100644 --- a/src/slurmd/slurmd/req.c +++ b/src/slurmd/slurmd/req.c @@ -849,6 +849,27 @@ _forkexec_slurmstepd(uint16_t type, void *req, snprintf(log_file, sizeof(log_file), "--log-file=/tmp/slurmstepd_valgrind_%u.%u", job_id, step_id); +#elif (SLURMSTEPD_MEMCHECK == 3) + /* valgrind test of slurmstepd, option #2 */ + uint32_t job_id = 0, step_id = 0; + char log_file[256]; + char *const argv[10] = {"valgrind", "--tool=drd", + "--error-limit=no", + "--max-stackframe=16777216", + "--num-callers=20", + "--child-silent-after-fork=yes", + log_file, (char *)conf->stepd_loc, + NULL}; + if (type == LAUNCH_BATCH_JOB) { + job_id = ((batch_job_launch_msg_t *)req)->job_id; + step_id = ((batch_job_launch_msg_t *)req)->step_id; + } else if (type == LAUNCH_TASKS) { + job_id = ((launch_tasks_request_msg_t *)req)->job_id; + step_id = ((launch_tasks_request_msg_t *)req)->job_step_id; + } + snprintf(log_file, sizeof(log_file), + "--log-file=/tmp/slurmstepd_valgrind_%u.%u", + job_id, step_id); #else /* no memory checking, default */ char *const argv[2] = { (char *)conf->stepd_loc, NULL};