Integrated sequential code into the benchmark main loop.
A bit ugly but shows that the code logic hasn't changed.master
parent
fb66e77072
commit
3ee3e9ad5c
109
src/ior.c
109
src/ior.c
|
@ -1644,47 +1644,6 @@ static void ValidateTests(IOR_param_t * test)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a precomputed array of IOR_offset_t for the inner benchmark loop.
|
|
||||||
* They are sequential and the last element is set to -1 as end marker.
|
|
||||||
* @param test IOR_param_t for getting transferSize, blocksize and SegmentCount
|
|
||||||
* @param pretendRank int pretended Rank for shifting the offsets correctly
|
|
||||||
* @return IOR_offset_t
|
|
||||||
*/
|
|
||||||
IOR_offset_t *GetOffsetArraySequential(IOR_param_t * test, int pretendRank)
|
|
||||||
{
|
|
||||||
IOR_offset_t i, j, k = 0;
|
|
||||||
IOR_offset_t offsets;
|
|
||||||
IOR_offset_t *offsetArray;
|
|
||||||
|
|
||||||
/* count needed offsets */
|
|
||||||
offsets = (test->blockSize / test->transferSize) * test->segmentCount;
|
|
||||||
|
|
||||||
/* setup empty array */
|
|
||||||
offsetArray =
|
|
||||||
(IOR_offset_t *) malloc((offsets + 1) * sizeof(IOR_offset_t));
|
|
||||||
if (offsetArray == NULL)
|
|
||||||
ERR("malloc() failed");
|
|
||||||
offsetArray[offsets] = -1; /* set last offset with -1 */
|
|
||||||
|
|
||||||
/* fill with offsets */
|
|
||||||
for (i = 0; i < test->segmentCount; i++) {
|
|
||||||
for (j = 0; j < (test->blockSize / test->transferSize); j++) {
|
|
||||||
offsetArray[k] = j * test->transferSize;
|
|
||||||
if (test->filePerProc) {
|
|
||||||
offsetArray[k] += i * test->blockSize;
|
|
||||||
} else {
|
|
||||||
offsetArray[k] +=
|
|
||||||
(i * test->numTasks * test->blockSize)
|
|
||||||
+ (pretendRank * test->blockSize);
|
|
||||||
}
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (offsetArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a precomputed array of IOR_offset_t for the inner benchmark loop.
|
* Returns a precomputed array of IOR_offset_t for the inner benchmark loop.
|
||||||
* They get created sequentially and mixed up in the end. The last array element
|
* They get created sequentially and mixed up in the end. The last array element
|
||||||
|
@ -1769,15 +1728,13 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce
|
||||||
return (offsetArray);
|
return (offsetArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offsetArray, int pretendRank,
|
static IOR_offset_t WriteOrReadSingle(IOR_offset_t offset, int pretendRank,
|
||||||
IOR_offset_t * transferCount, int * errors, IOR_param_t * test, aiori_fd_t * fd, IOR_io_buffers* ioBuffers, int access){
|
IOR_offset_t * transferCount, int * errors, IOR_param_t * test, aiori_fd_t * fd, IOR_io_buffers* ioBuffers, int access){
|
||||||
IOR_offset_t amtXferred = 0;
|
IOR_offset_t amtXferred = 0;
|
||||||
IOR_offset_t transfer;
|
IOR_offset_t transfer;
|
||||||
|
|
||||||
void *buffer = ioBuffers->buffer;
|
void *buffer = ioBuffers->buffer;
|
||||||
|
|
||||||
IOR_offset_t offset = offsetArray[pairCnt]; // this looks inappropriate
|
|
||||||
|
|
||||||
transfer = test->transferSize;
|
transfer = test->transferSize;
|
||||||
if (access == WRITE) {
|
if (access == WRITE) {
|
||||||
/* fills each transfer with a unique pattern
|
/* fills each transfer with a unique pattern
|
||||||
|
@ -1830,41 +1787,48 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results,
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
IOR_offset_t transferCount = 0;
|
IOR_offset_t transferCount = 0;
|
||||||
uint64_t pairCnt = 0;
|
uint64_t pairCnt = 0;
|
||||||
IOR_offset_t *offsetArray;
|
|
||||||
int pretendRank;
|
int pretendRank;
|
||||||
IOR_offset_t dataMoved = 0; /* for data rate calculation */
|
IOR_offset_t dataMoved = 0; /* for data rate calculation */
|
||||||
double startForStonewall;
|
double startForStonewall;
|
||||||
int hitStonewall;
|
int hitStonewall;
|
||||||
|
int i, j;
|
||||||
IOR_point_t *point = ((access == WRITE) || (access == WRITECHECK)) ?
|
IOR_point_t *point = ((access == WRITE) || (access == WRITECHECK)) ?
|
||||||
&results->write : &results->read;
|
&results->write : &results->read;
|
||||||
|
|
||||||
/* initialize values */
|
/* initialize values */
|
||||||
pretendRank = (rank + rankOffset) % test->numTasks;
|
pretendRank = (rank + rankOffset) % test->numTasks;
|
||||||
|
|
||||||
if (test->randomOffset) {
|
// offsetArray = GetOffsetArraySequential(test, pretendRank);
|
||||||
offsetArray = GetOffsetArrayRandom(test, pretendRank, access);
|
|
||||||
} else {
|
|
||||||
offsetArray = GetOffsetArraySequential(test, pretendRank);
|
|
||||||
}
|
|
||||||
|
|
||||||
startForStonewall = GetTimeStamp();
|
startForStonewall = GetTimeStamp();
|
||||||
hitStonewall = 0;
|
hitStonewall = 0;
|
||||||
|
|
||||||
/* loop over offsets to access */
|
for (i = 0; i < test->segmentCount && !hitStonewall; i++) {
|
||||||
while ((offsetArray[pairCnt] != -1) && !hitStonewall ) {
|
for (j = 0; j < (test->blockSize / test->transferSize) && !hitStonewall ; j++) {
|
||||||
dataMoved += WriteOrReadSingle(pairCnt, offsetArray, pretendRank, & transferCount, & errors, test, fd, ioBuffers, access);
|
IOR_offset_t offset;
|
||||||
pairCnt++;
|
if (test->randomOffset) {
|
||||||
|
|
||||||
hitStonewall = ((test->deadlineForStonewalling != 0
|
}else{
|
||||||
&& (GetTimeStamp() - startForStonewall)
|
offset = j * test->transferSize;
|
||||||
> test->deadlineForStonewalling)) || (test->stoneWallingWearOutIterations != 0 && pairCnt == test->stoneWallingWearOutIterations) ;
|
if (test->filePerProc) {
|
||||||
|
offset += i * test->blockSize;
|
||||||
|
} else {
|
||||||
|
offset += (i * test->numTasks * test->blockSize) + (pretendRank * test->blockSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMoved += WriteOrReadSingle(offset, pretendRank, & transferCount, & errors, test, fd, ioBuffers, access);
|
||||||
|
pairCnt++;
|
||||||
|
|
||||||
if ( test->collective && test->deadlineForStonewalling ) {
|
hitStonewall = ((test->deadlineForStonewalling != 0
|
||||||
// if collective-mode, you'll get a HANG, if some rank 'accidentally' leave this loop
|
&& (GetTimeStamp() - startForStonewall) > test->deadlineForStonewalling))
|
||||||
// it absolutely must be an 'all or none':
|
|| (test->stoneWallingWearOutIterations != 0 && pairCnt == test->stoneWallingWearOutIterations) ;
|
||||||
MPI_CHECK(MPI_Bcast(&hitStonewall, 1, MPI_INT, 0, MPI_COMM_WORLD), "hitStonewall broadcast failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ( test->collective && test->deadlineForStonewalling ) {
|
||||||
|
// if collective-mode, you'll get a HANG, if some rank 'accidentally' leave this loop
|
||||||
|
// it absolutely must be an 'all or none':
|
||||||
|
MPI_CHECK(MPI_Bcast(&hitStonewall, 1, MPI_INT, 0, MPI_COMM_WORLD), "hitStonewall broadcast failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (test->stoneWallingWearOut){
|
if (test->stoneWallingWearOut){
|
||||||
if (verbose >= VERBOSE_1){
|
if (verbose >= VERBOSE_1){
|
||||||
|
@ -1891,19 +1855,30 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results,
|
||||||
}
|
}
|
||||||
if(pairCnt != point->pairs_accessed){
|
if(pairCnt != point->pairs_accessed){
|
||||||
// some work needs still to be done !
|
// some work needs still to be done !
|
||||||
for(; pairCnt < point->pairs_accessed; pairCnt++ ) {
|
for ( ; pairCnt < point->pairs_accessed; i++) {
|
||||||
dataMoved += WriteOrReadSingle(pairCnt, offsetArray, pretendRank, & transferCount, & errors, test, fd, ioBuffers, access);
|
for ( ; j < (test->blockSize / test->transferSize) && pairCnt < point->pairs_accessed ; j++) {
|
||||||
|
IOR_offset_t offset;
|
||||||
|
if (test->randomOffset) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
offset = j * test->transferSize;
|
||||||
|
if (test->filePerProc) {
|
||||||
|
offset += i * test->blockSize;
|
||||||
|
} else {
|
||||||
|
offset += (i * test->numTasks * test->blockSize) + (pretendRank * test->blockSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMoved += WriteOrReadSingle(offset, pretendRank, & transferCount, & errors, test, fd, ioBuffers, access);
|
||||||
|
pairCnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
point->pairs_accessed = pairCnt;
|
point->pairs_accessed = pairCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
totalErrorCount += CountErrors(test, access, errors);
|
totalErrorCount += CountErrors(test, access, errors);
|
||||||
|
|
||||||
free(offsetArray);
|
|
||||||
|
|
||||||
if (access == WRITE && test->fsync == TRUE) {
|
if (access == WRITE && test->fsync == TRUE) {
|
||||||
backend->fsync(fd, test->backend_options); /*fsync after all accesses */
|
backend->fsync(fd, test->backend_options); /*fsync after all accesses */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue