Commit f4400cb3 authored by Philip Carns's avatar Philip Carns

- change delimiter for hints to ;

- modify metadata parsing to allow = in values
- store hints verbatim in value portion of h=value field in metadata


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@456 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 1888e88b
......@@ -1304,7 +1304,7 @@ Optional Packages:
--with-mem-align=<num> Memory alignment in bytes
--with-zlib-for-mpi=<dir> base dir for zlib to use on mpi processes
--with-log-path-by-env=<env var list> Comma separated list of environment variables to check for log path location before --with-log-path path
--with-log-hints=<hint1=x,hint2=y> Comma-separated list of MPI-IO hints for log file write
--with-log-hints=<hint1=x,hint2=y> Semicolon-separated list of MPI-IO hints for log file write
--with-log-path=<path> Location to store log files at run time
--with-jobid-env=<name> Name of environment variable that stores the jobid
(specify "NONE" if no appropriate environment variable is available:
......@@ -3933,7 +3933,7 @@ fi
if test x$GOT_JOBID != x1; then
as_fn_error $? "must provide --with-jobid-env=<name> argument to configure." "$LINENO" 5
fi
__CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true,cb_nodes=8"
__CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true;cb_nodes=8"
if test x$GOT_LOG_HINTS != x1; then
cat >>confdefs.h <<_ACEOF
......
......@@ -71,11 +71,11 @@ AC_ARG_WITH(log-path-by-env,
)
AC_ARG_WITH(log-hints,
[ --with-log-hints=<hint1=x,hint2=y> Comma-separated list of MPI-IO hints for log file write],
[ --with-log-hints=<hint1=x,hint2=y> Semicolon-separated list of MPI-IO hints for log file write],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-log-hints must be given an argument)
else
AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "${withval}", Comma-separated list of MPI-IO hints for log file write)
AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "${withval}", Semicolon-separated list of MPI-IO hints for log file write)
__CP_LOG_HINTS="${withval}"
GOT_LOG_HINTS=1
fi
......@@ -117,7 +117,7 @@ fi
if test x$GOT_JOBID != x1; then
AC_MSG_ERROR(must provide --with-jobid-env=<name> argument to configure.)
fi
__CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true,cb_nodes=8"
__CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true;cb_nodes=8"
if test x$GOT_LOG_HINTS != x1; then
dnl use default hints
AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "$__CP_LOG_HINTS_DEFAULT", Comma-separated list of MPI-IO hints for log file write)
......
......@@ -326,6 +326,7 @@ darshan_fd darshan_log_open(const char *name, const char* mode)
int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
{
int ret;
char buffer[DARSHAN_JOB_METADATA_LEN];
ret = darshan_log_seek(file, 0);
if(ret < 0)
......@@ -395,19 +396,28 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
char *kv;
char *ptr;
char *key;
char *val;
char *value;
char *save;
char *save2;
for(kv=strtok_r(metadata, "\n", &save);
kv != NULL;
kv=strtok_r(NULL, "\n", &save))
{
key = strtok_r(kv, "=", &save2);
val = strtok_r(NULL, "=", &save2);
/* NOTE: we intentionally only split on the first = character.
* There may be additional = characters in the value portion
* (for example, when storing mpi-io hints).
*/
strcpy(buffer, kv);
key = buffer;
value = index(buffer, '=');
if(!value)
continue;
/* convert = to a null terminator to split key and value */
value[0] = '\0';
value++;
if (strcmp(key, "prev_ver") == 0)
{
strncpy(job->version_string, val, sizeof(job->version_string));
strncpy(job->version_string, value, sizeof(job->version_string));
}
}
free(metadata);
......
......@@ -190,6 +190,7 @@ int main(int argc, char **argv)
int last_rank = 0;
char *token;
char *save;
char buffer[DARSHAN_JOB_METADATA_LEN];
hash_entry_t *file_hash = NULL;
hash_entry_t *curr = NULL;
......@@ -250,13 +251,21 @@ int main(int argc, char **argv)
token != NULL;
token=strtok_r(NULL, "\n", &save))
{
char *save2;
char *key;
char *val;
key = strtok_r(token, "=", &save2);
val = strtok_r(NULL, "=", &save2);
printf("# metadata: %s = %s\n", key, val);
char *value;
/* NOTE: we intentionally only split on the first = character.
* There may be additional = characters in the value portion
* (for example, when storing mpi-io hints).
*/
strcpy(buffer, token);
key = buffer;
value = index(buffer, '=');
if(!value)
continue;
/* convert = to a null terminator to split key and value */
value[0] = '\0';
value++;
printf("# metadata: %s = %s\n", key, value);
}
/* print table of mounted file systems */
......
......@@ -1913,8 +1913,8 @@ static int cp_log_write(struct darshan_job_runtime* final_job, int rank,
{
do
{
/* split string on commas */
key = strtok_r(tok_str, ",", &saveptr);
/* split string on semicolon */
key = strtok_r(tok_str, ";", &saveptr);
if(key)
{
tok_str = NULL;
......@@ -2441,7 +2441,6 @@ static void cp_log_record_hints(struct darshan_job_runtime* final_job, int rank)
char* hints;
char* header_hints;
int meta_remain = 0;
int i;
/* only need to do this on first process */
if(rank > 0)
......@@ -2468,15 +2467,10 @@ static void cp_log_record_hints(struct darshan_job_runtime* final_job, int rank)
if(meta_remain >= (3 + strlen(header_hints)))
{
/* We have room to store the hints in the metadata portion of
* the job header. We just need to convert '=' into another
* character so that it doesn't conflict with the delimiter used
* in the Darshan header.
* the job header. We just prepend an h= to the hints list. The
* metadata parser will ignore = characters that appear in the value
* portion of the metadata key/value pair.
*/
for(i=0; i<strlen(header_hints); i++)
{
if(header_hints[i] == '=')
header_hints[i] = ':';
}
strcat(final_job->log_job.metadata, "h=");
strcat(final_job->log_job.metadata, header_hints);
}
......
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