Enable random seed to be stored. (#268)
parent
cb397242f9
commit
fb66e77072
22
src/ior.c
22
src/ior.c
|
@ -1622,8 +1622,8 @@ static void ValidateTests(IOR_param_t * test)
|
|||
if (test->randomOffset && test->reorderTasks
|
||||
&& test->filePerProc == FALSE)
|
||||
ERR("random offset and constant reorder tasks specified with single-shared-file. Choose one and resubmit");
|
||||
if (test->randomOffset && test->checkRead)
|
||||
ERR("random offset not available with read check option (use write check)");
|
||||
if (test->randomOffset && test->checkRead && test->randomSeed == -1)
|
||||
ERR("random offset with read check option requires to set the random seed");
|
||||
if (test->randomOffset && test->storeFileOffset)
|
||||
ERR("random offset not available with store file offset option)");
|
||||
if ((strcasecmp(test->api, "HDF5") == 0) && test->randomOffset)
|
||||
|
@ -1709,11 +1709,11 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce
|
|||
IOR_offset_t fileSize;
|
||||
IOR_offset_t *offsetArray;
|
||||
|
||||
/* set up seed for random() */
|
||||
if (access == WRITE || access == READ) {
|
||||
/* set up seed, each process can determine which regions to access individually */
|
||||
if (test->randomSeed == -1) {
|
||||
test->randomSeed = seed = rand();
|
||||
} else {
|
||||
seed = test->randomSeed;
|
||||
seed = test->randomSeed + pretendRank;
|
||||
}
|
||||
srand(seed);
|
||||
|
||||
|
@ -1723,16 +1723,16 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce
|
|||
}
|
||||
|
||||
/* count needed offsets (pass 1) */
|
||||
for (i = 0; i < fileSize; i += test->transferSize) {
|
||||
if (test->filePerProc == FALSE) {
|
||||
if (test->filePerProc == FALSE) {
|
||||
for (i = 0; i < fileSize; i += test->transferSize) {
|
||||
// this counts which process get how many transferes in
|
||||
// a shared file
|
||||
if ((rand() % test->numTasks) == pretendRank) {
|
||||
offsets++;
|
||||
}
|
||||
} else {
|
||||
offsets++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
offsets += fileSize / test->transferSize;
|
||||
}
|
||||
|
||||
/* setup empty array */
|
||||
|
@ -1749,7 +1749,7 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce
|
|||
}
|
||||
} else {
|
||||
/* fill with offsets (pass 2) */
|
||||
srand(seed); /* need same seed to get same transfers as counted in the beginning*/
|
||||
srand(seed); /* need same seedto get same transfers as counted in the beginning*/
|
||||
for (i = 0; i < fileSize; i += test->transferSize) {
|
||||
if ((rand() % test->numTasks) == pretendRank) {
|
||||
offsetArray[offsetCnt] = i;
|
||||
|
|
|
@ -433,6 +433,7 @@ option_help * createGlobalOptions(IOR_param_t * params){
|
|||
{'y', NULL, "dualMount -- use dual mount points for a filesystem", OPTION_FLAG, 'd', & params->dualMount},
|
||||
{'Y', NULL, "fsyncPerWrite -- perform sync operation after every write operation", OPTION_FLAG, 'd', & params->fsyncPerWrite},
|
||||
{'z', NULL, "randomOffset -- access is to random, not sequential, offsets within a file", OPTION_FLAG, 'd', & params->randomOffset},
|
||||
{0, "random-offset-seed", "The seed for -z", OPTION_OPTIONAL_ARGUMENT, 'd', & params->randomSeed},
|
||||
{'Z', NULL, "reorderTasksRandom -- changes task ordering to random ordering for readback", OPTION_FLAG, 'd', & params->reorderTasksRandom},
|
||||
{0, "warningAsErrors", "Any warning should lead to an error.", OPTION_FLAG, 'd', & params->warningAsErrors},
|
||||
{.help=" -O summaryFile=FILE -- store result data into this file", .arg = OPTION_OPTIONAL_ARGUMENT},
|
||||
|
|
Loading…
Reference in New Issue