Commit f26baefc authored by Shane Snyder's avatar Shane Snyder

allow job end time to be set by darshan-merge

parent 37b1bb02
......@@ -11,6 +11,8 @@ DARSHAN_INSTALL_DIR=@prefix@
# use the log dir specified at configure time
DARSHAN_LOG_DIR=@__DARSHAN_LOG_PATH@
JOB_END=$(date +"%s")
# use the default mmap log directory (/tmp), unless the
# env variable is set to something
if [ -z "$DARSHAN_MMAP_LOGPATH" ]; then
......@@ -53,7 +55,7 @@ if [ $SLURM_NNODES -gt 1 ]; then
mkdir -p $NODE_LOG_DIR
# construct the per-node log file and store in the output directory
$DARSHAN_INSTALL_DIR/bin/darshan-merge \
$DARSHAN_INSTALL_DIR/bin/darshan-merge --job-end-time $JOB_END \
--output ${NODE_LOG_DIR}/${LOG_NAME_PRE}_${NODE_NAME}.darshan \
$DARSHAN_MMAP_LOG_GLOB
else
......@@ -61,7 +63,7 @@ else
# single node, just create the final output darshan log
LOG_WRITE_START=$(date +%s)
$DARSHAN_INSTALL_DIR/bin/darshan-merge
$DARSHAN_INSTALL_DIR/bin/darshan-merge --job-end-time $JOB_END \
--shared-redux --output ${OUTPUT_LOG_DIR}/${TMP_LOG} \
$DARSHAN_MMAP_LOG_GLOB
LOG_WRITE_END=$(date +%s)
......@@ -72,4 +74,6 @@ else
mv ${OUTPUT_LOG_DIR}/${TMP_LOG} ${OUTPUT_LOG_DIR}/${FINAL_LOG}
fi
rm -f $DARSHAN_MMAP_LOG_GLOB
exit 0
......@@ -28,23 +28,27 @@ void usage(char *exename)
fprintf(stderr, "Options:\n");
fprintf(stderr, "\t--output\t(REQUIRED) Full path of the output darshan log file.\n");
fprintf(stderr, "\t--shared-redux\tReduce globally shared records into a single record.\n");
fprintf(stderr, "\t--job-end-time\tSet the output log's job end time (requires argument of seconds since Epoch).\n");
exit(1);
}
void parse_args(int argc, char **argv, char ***infile_list, int *n_files,
char **outlog_path, int *shared_redux)
char **outlog_path, int *shared_redux, int64_t *job_end_time)
{
int index;
char *check;
static struct option long_opts[] =
{
{"shared-redux", no_argument, NULL, 's'},
{"output", required_argument, NULL, 'o'},
{"shared-redux", no_argument, NULL, 's'},
{"job-end-time", required_argument, NULL, 'e'},
{0, 0, 0, 0}
};
*shared_redux = 0;
*outlog_path = NULL;
*job_end_time = 0;
while(1)
{
......@@ -60,6 +64,14 @@ void parse_args(int argc, char **argv, char ***infile_list, int *n_files,
case 'o':
*outlog_path = optarg;
break;
case 'e':
*job_end_time = strtol(optarg, &check, 10);
if(optarg == check)
{
fprintf(stderr, "Error: unable to parse job end time value.\n");
exit(1);
}
break;
case '?':
default:
usage(argv[0]);
......@@ -173,6 +185,7 @@ int main(int argc, char *argv[])
char **infile_list;
int n_infiles;
int shared_redux;
int64_t job_end_time = 0;
char *outlog_path;
darshan_fd in_fd, merge_fd;
struct darshan_job in_job, merge_job;
......@@ -191,7 +204,7 @@ int main(int argc, char *argv[])
int ret;
/* grab command line arguments */
parse_args(argc, argv, &infile_list, &n_infiles, &outlog_path, &shared_redux);
parse_args(argc, argv, &infile_list, &n_infiles, &outlog_path, &shared_redux, &job_end_time);
memset(&merge_job, 0, sizeof(struct darshan_job));
......@@ -305,6 +318,10 @@ int main(int argc, char *argv[])
darshan_log_close(in_fd);
}
/* if a job end time was passed in, apply it to the output job */
if(job_end_time > 0)
merge_job.end_time = job_end_time;
/* create the output "merged" log */
merge_fd = darshan_log_create(outlog_path, DARSHAN_ZLIB_COMP, 1);
if(merge_fd == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment