Commit 79ec6b82 authored by Shane Snyder's avatar Shane Snyder

allow mem env variables to be floats

this allows us to request memory allocations at smaller granularity
than MiB
parent 7bebe64f
...@@ -156,8 +156,9 @@ void darshan_core_initialize(int argc, char **argv) ...@@ -156,8 +156,9 @@ void darshan_core_initialize(int argc, char **argv)
char *jobid_str; char *jobid_str;
int jobid; int jobid;
int ret; int ret;
int tmpval;
int i; int i;
int tmpval;
double tmpfloat;
DARSHAN_MPI_CALL(PMPI_Comm_size)(MPI_COMM_WORLD, &nprocs); DARSHAN_MPI_CALL(PMPI_Comm_size)(MPI_COMM_WORLD, &nprocs);
DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &my_rank); DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &my_rank);
...@@ -219,11 +220,11 @@ void darshan_core_initialize(int argc, char **argv) ...@@ -219,11 +220,11 @@ void darshan_core_initialize(int argc, char **argv)
envstr = getenv(DARSHAN_MOD_MEM_OVERRIDE); envstr = getenv(DARSHAN_MOD_MEM_OVERRIDE);
if(envstr) if(envstr)
{ {
ret = sscanf(envstr, "%d", &tmpval); ret = sscanf(envstr, "%lf", &tmpfloat);
/* silently ignore if the env variable is set poorly */ /* silently ignore if the env variable is set poorly */
if(ret == 1 && tmpval > 0) if(ret == 1 && tmpfloat > 0)
{ {
darshan_mod_mem_quota = tmpval * 1024 * 1024; /* convert from MiB */ darshan_mod_mem_quota = tmpfloat * 1024 * 1024; /* convert from MiB */
} }
} }
......
...@@ -379,7 +379,8 @@ static void dxt_posix_runtime_initialize() ...@@ -379,7 +379,8 @@ static void dxt_posix_runtime_initialize()
* over realloc'ing module memory as needed. * over realloc'ing module memory as needed.
*/ */
int dxt_psx_buf_size = 0; int dxt_psx_buf_size = 0;
int ret, tmpval; int ret;
double tmpfloat;
char *envstr; char *envstr;
/* register the DXT module with darshan core */ /* register the DXT module with darshan core */
...@@ -411,11 +412,11 @@ static void dxt_posix_runtime_initialize() ...@@ -411,11 +412,11 @@ static void dxt_posix_runtime_initialize()
envstr = getenv("ENABLE_DXT_IO_TRACE_MEM"); envstr = getenv("ENABLE_DXT_IO_TRACE_MEM");
if(envstr && dxt_mpiio_runtime == NULL) if(envstr && dxt_mpiio_runtime == NULL)
{ {
ret = sscanf(envstr, "%d", &tmpval); ret = sscanf(envstr, "%lf", &tmpfloat);
/* silently ignore if the env variable is set poorly */ /* silently ignore if the env variable is set poorly */
if(ret == 1 && tmpval > 0) if(ret == 1 && tmpfloat > 0)
{ {
dxt_mem_remaining = tmpval * 1024 * 1024; /* convert from MiB */ dxt_mem_remaining = tmpfloat * 1024 * 1024; /* convert from MiB */
} }
} }
DXT_UNLOCK(); DXT_UNLOCK();
...@@ -430,7 +431,8 @@ void dxt_mpiio_runtime_initialize() ...@@ -430,7 +431,8 @@ void dxt_mpiio_runtime_initialize()
* over realloc'ing module memory as needed. * over realloc'ing module memory as needed.
*/ */
int dxt_mpiio_buf_size = 0; int dxt_mpiio_buf_size = 0;
int ret, tmpval; int ret;
double tmpfloat;
char *envstr; char *envstr;
/* register the DXT module with darshan core */ /* register the DXT module with darshan core */
...@@ -462,11 +464,11 @@ void dxt_mpiio_runtime_initialize() ...@@ -462,11 +464,11 @@ void dxt_mpiio_runtime_initialize()
envstr = getenv("ENABLE_DXT_IO_TRACE_MEM"); envstr = getenv("ENABLE_DXT_IO_TRACE_MEM");
if(envstr && dxt_posix_runtime == NULL) if(envstr && dxt_posix_runtime == NULL)
{ {
ret = sscanf(envstr, "%d", &tmpval); ret = sscanf(envstr, "%lf", &tmpfloat);
/* silently ignore if the env variable is set poorly */ /* silently ignore if the env variable is set poorly */
if(ret == 1 && tmpval > 0) if(ret == 1 && tmpfloat > 0)
{ {
dxt_mem_remaining = tmpval * 1024 * 1024; /* convert from MiB */ dxt_mem_remaining = tmpfloat * 1024 * 1024; /* convert from MiB */
} }
} }
DXT_UNLOCK(); DXT_UNLOCK();
......
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