Moved GetFileSize into CheckFileSize, starting to simplify get_file_size (too much replication in modules).
parent
5a5b90cdaa
commit
3395fc621c
41
src/ior.c
41
src/ior.c
|
@ -313,7 +313,7 @@ CheckForOutliers(IOR_param_t *test, const double *timer, const int access)
|
|||
* Check if actual file size equals expected size; if not use actual for
|
||||
* calculating performance rate.
|
||||
*/
|
||||
static void CheckFileSize(IOR_test_t *test, IOR_offset_t dataMoved, int rep,
|
||||
static void CheckFileSize(IOR_test_t *test, char * testFilename, IOR_offset_t dataMoved, int rep,
|
||||
const int access)
|
||||
{
|
||||
IOR_param_t *params = &test->params;
|
||||
|
@ -321,6 +321,32 @@ static void CheckFileSize(IOR_test_t *test, IOR_offset_t dataMoved, int rep,
|
|||
IOR_point_t *point = (access == WRITE) ? &results[rep].write :
|
||||
&results[rep].read;
|
||||
|
||||
/* get the size of the file */
|
||||
IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
|
||||
aggFileSizeFromStat = backend->get_file_size(params->backend_options, testComm, testFilename);
|
||||
|
||||
if (params->hints.filePerProc == TRUE) {
|
||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1,
|
||||
MPI_LONG_LONG_INT, MPI_SUM, testComm),
|
||||
"cannot reduce total data moved");
|
||||
aggFileSizeFromStat = tmpSum;
|
||||
} else {
|
||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMin, 1,
|
||||
MPI_LONG_LONG_INT, MPI_MIN, testComm),
|
||||
"cannot reduce total data moved");
|
||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMax, 1,
|
||||
MPI_LONG_LONG_INT, MPI_MAX, testComm),
|
||||
"cannot reduce total data moved");
|
||||
if (tmpMin != tmpMax) {
|
||||
if (rank == 0) {
|
||||
WARN("inconsistent file size by different tasks");
|
||||
}
|
||||
/* incorrect, but now consistent across tasks */
|
||||
aggFileSizeFromStat = tmpMin;
|
||||
}
|
||||
}
|
||||
point->aggFileSizeFromStat = aggFileSizeFromStat;
|
||||
|
||||
MPI_CHECK(MPI_Allreduce(&dataMoved, &point->aggFileSizeFromXfer,
|
||||
1, MPI_LONG_LONG_INT, MPI_SUM, testComm),
|
||||
"cannot total data moved");
|
||||
|
@ -1379,13 +1405,9 @@ static void TestIoSys(IOR_test_t *test)
|
|||
timer[5] = GetTimeStamp();
|
||||
MPI_CHECK(MPI_Barrier(testComm), "barrier error");
|
||||
|
||||
/* get the size of the file just written */
|
||||
results[rep].write.aggFileSizeFromStat =
|
||||
backend->get_file_size(params->backend_options, testComm, testFileName);
|
||||
|
||||
/* check if stat() of file doesn't equal expected file size,
|
||||
use actual amount of byte moved */
|
||||
CheckFileSize(test, dataMoved, rep, WRITE);
|
||||
CheckFileSize(test, testFileName, dataMoved, rep, WRITE);
|
||||
|
||||
if (verbose >= VERBOSE_3)
|
||||
WriteTimes(params, timer, rep, WRITE);
|
||||
|
@ -1519,14 +1541,9 @@ static void TestIoSys(IOR_test_t *test)
|
|||
backend->close(fd, params->backend_options);
|
||||
timer[5] = GetTimeStamp();
|
||||
|
||||
/* get the size of the file just read */
|
||||
results[rep].read.aggFileSizeFromStat =
|
||||
backend->get_file_size(params->backend_options, testComm,
|
||||
testFileName);
|
||||
|
||||
/* check if stat() of file doesn't equal expected file size,
|
||||
use actual amount of byte moved */
|
||||
CheckFileSize(test, dataMoved, rep, READ);
|
||||
CheckFileSize(test, testFileName, dataMoved, rep, READ);
|
||||
|
||||
if (verbose >= VERBOSE_3)
|
||||
WriteTimes(params, timer, rep, READ);
|
||||
|
|
Loading…
Reference in New Issue