-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio-model.c
668 lines (564 loc) · 19.9 KB
/
io-model.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <mpi.h>
#include "mem-eater.c"
#ifndef VERSION
#warning "NO VERSION DEFINED"
#define VERSION "unknown"
#endif
static int rank;
static int size;
enum locality{
LOCALITY_OFF0 = 0,
LOCALITY_SEQUENTIAL = 1,
LOCALITY_RANDOM = 2,
LOCALITY_STRIDED = 3,
LOCALITY_RANDOM_NEARBY = 4,
LOCALITY_REVERSE_STRIDED = 5,
LOCALITY_RANDOM_NEARBY_STRIDE = 6,
};
struct options{
char * filename;
size_t memoryBufferInMiB;
size_t fileSizeInMiB;
size_t maxRepeats;
size_t accessSize;
size_t preallocateMemoryInMiB;
enum locality localityInMemory;
enum locality localityInFile;
// based on the locality setting
size_t localityMemParameter;
size_t localityFileParameter;
size_t localityMemParameter2;
size_t localityFileParameter2;
int truncate;
int preWriteMem;
int preWriteFile;
int isRead;
int isWaitForProperSize;
int printOffsets;
char * deviceName;
};
struct runtime{
char * buff;
FILE * outputFile;
size_t memBufferInBytes;
size_t fileSizeInByte;
// which offset is the last one we can use to write a full accessSize from mem to file
size_t lastMemOffset;
size_t lastFileffset;
// max number of repeats fitting in the file
size_t repeatsToMatchFileSize;
// actual number of repeats done
size_t doneRepeats;
// for sequential access and nearby access
int64_t curMemPosition;
};
static struct runtime r;
static struct options o;
static char * mmalloc(size_t size){
char * buff = malloc(size);
if (buff == NULL){
printf("Error could not allocate %llu MiB of memory\n", (long long unsigned) size/1024/1024);
MPI_Abort(MPI_COMM_WORLD, 1);
}
return buff;
}
typedef struct timespec Timer;
static Timer start_time;
static void timerStart(Timer *tp)
{
clock_gettime(CLOCK_MONOTONIC, tp);
}
static double timeSinceStart(Timer tp){
return (tp.tv_sec - start_time.tv_sec) + 0.001*0.001*0.001 * (tp.tv_nsec - start_time.tv_nsec);
}
static double timerEnd(Timer *start)
{
struct timespec tp;
clock_gettime(CLOCK_MONOTONIC, &tp);
return (tp.tv_sec - start->tv_sec) + 0.001*0.001*0.001 * (tp.tv_nsec -start->tv_nsec);
}
#include "proc-stats.c"
static int MYopen(const char *pathname, int flags, mode_t mode){
int ret;
ret = open(pathname, flags, mode);
if(ret == 0){
printf("Error opening %s: %s\n", pathname, strerror(errno));
}
return ret;
}
static off_t MYlseek(int fd, off_t offset, int whence){
off_t ret;
ret = lseek(fd, offset, whence);
if(ret == (off_t) -1){
printf("Error lseek to %llu: %s\n", (long long unsigned) offset, strerror(errno));
}
return ret;
}
static void checkIOError(size_t expected, size_t returned){
if(expected != returned){
printf("Error while checking for I/O access: \"%s\", %llu != %llu\n",
strerror(errno),
(long long unsigned) expected,
(long long unsigned) returned
);
}
}
static inline void initMemPos(){
switch(o.localityInMemory){
case(LOCALITY_SEQUENTIAL):{
r.curMemPosition = 0;
return;
}
case(LOCALITY_OFF0):{
r.curMemPosition = 0;
return;
}
case(LOCALITY_RANDOM):{
r.curMemPosition = (((size_t) rand())*128) % r.lastMemOffset;
return;
}
case(LOCALITY_RANDOM_NEARBY):{
r.curMemPosition = -((int64_t) o.localityMemParameter) + ((size_t) rand()) % (2*o.localityMemParameter);
return;
}
case(LOCALITY_STRIDED):{
r.curMemPosition = o.localityMemParameter;
return;
}
case(LOCALITY_RANDOM_NEARBY_STRIDE):{
r.curMemPosition = o.localityMemParameter + -((int64_t) o.localityMemParameter2) + ((size_t) rand()) % (2*o.localityMemParameter2);
if (r.curMemPosition > r.lastMemOffset ){
r.curMemPosition = r.curMemPosition % r.lastMemOffset;
}
return;
}
case(LOCALITY_REVERSE_STRIDED):{
r.curMemPosition = r.lastMemOffset - o.localityMemParameter;
return;
}
}
}
static inline int64_t pickNextMemPos(){
switch(o.localityInMemory){
case(LOCALITY_SEQUENTIAL):{
int64_t oldPos = r.curMemPosition;
r.curMemPosition += o.accessSize;
if (r.curMemPosition > r.lastMemOffset){
r.curMemPosition = r.curMemPosition % r.lastMemOffset;
}
return oldPos;
}
case(LOCALITY_OFF0):{
return 0;
}
case(LOCALITY_RANDOM):{
return (((size_t) rand())*128) % r.lastMemOffset;
}
case(LOCALITY_RANDOM_NEARBY):{
int64_t randomValue = - ((int64_t) o.localityMemParameter) + ((size_t) rand()) % (2*o.localityMemParameter);
int64_t targetPos = r.curMemPosition + randomValue;
randomValue += randomValue < 0 ? - o.accessSize : o.accessSize;
if ( targetPos < 0 || targetPos > r.lastMemOffset ){
targetPos = r.curMemPosition - randomValue;
}
return targetPos;
}
case(LOCALITY_STRIDED):{
int64_t oldPos = r.curMemPosition;
r.curMemPosition += o.accessSize + o.localityMemParameter;
if (r.curMemPosition > r.lastMemOffset){
r.curMemPosition = r.curMemPosition % r.lastMemOffset;
}
return oldPos;
}
case(LOCALITY_RANDOM_NEARBY_STRIDE):{
int64_t oldPos = r.curMemPosition;
r.curMemPosition += o.accessSize + o.localityMemParameter;
int64_t randomValue = - ((int64_t) o.localityMemParameter2) + ((size_t) rand()) % (2*o.localityMemParameter);
r.curMemPosition = r.curMemPosition + randomValue;
if (r.curMemPosition > r.lastMemOffset ){
r.curMemPosition = r.curMemPosition % r.lastMemOffset;
}
return oldPos;
}
case(LOCALITY_REVERSE_STRIDED):{
int64_t oldPos = r.curMemPosition;
r.curMemPosition = r.curMemPosition - (o.accessSize + o.localityMemParameter);
if (r.curMemPosition < 0){
r.curMemPosition = r.curMemPosition % r.lastMemOffset;
}
return oldPos;
}
}
}
static inline off_t setNextFilePos(int fd){
switch(o.localityInFile){
case(LOCALITY_SEQUENTIAL):{
// nothing needed
return lseek(fd, 0, SEEK_CUR);
}
case(LOCALITY_OFF0):{
MYlseek(fd, 0, SEEK_SET);
return 0;
}
case(LOCALITY_RANDOM):{
off_t newPos = ((off_t) rand())*10 % r.lastFileffset;
MYlseek(fd, newPos, SEEK_SET);
return newPos;
}
case(LOCALITY_RANDOM_NEARBY):{
off_t newPos = lseek(fd, 0, SEEK_CUR);
int64_t randomValue = - ((int64_t) o.localityFileParameter) + ((size_t) rand()) % (o.localityFileParameter*2);
// add or subtract the lastly accessed data block.
//printf("xq to %lld %lld\n", (long long int) randomValue, (long long int) newPos);
if (randomValue < 0 ) {
randomValue -= 2*o.accessSize;
}
if (newPos + randomValue > r.lastFileffset || newPos + randomValue < 0 ){
newPos = newPos - randomValue;
}else{
newPos = newPos + randomValue;
}
//printf("jumping to %lld\n", (long long int) newPos);
MYlseek(fd, newPos, SEEK_SET);
return newPos;
}
case(LOCALITY_STRIDED):{
off_t newPos = lseek(fd, 0, SEEK_CUR) + o.localityFileParameter;
if (newPos > r.lastFileffset){
newPos = newPos % r.lastFileffset;
}
MYlseek(fd, newPos, SEEK_SET);
return newPos;
}
case(LOCALITY_REVERSE_STRIDED):{
off_t newPos = lseek(fd, 0, SEEK_CUR) - 2* o.accessSize - o.localityFileParameter;
if (newPos < 0 ){
newPos = newPos % r.lastFileffset;
}
MYlseek(fd, newPos, SEEK_SET);
return newPos;
}
case(LOCALITY_RANDOM_NEARBY_STRIDE):{
off_t newPos = lseek(fd, 0, SEEK_CUR) + o.localityFileParameter;
int64_t randomValue = - ((int64_t) o.localityFileParameter2) + ((size_t) rand()) % (o.localityFileParameter2*2);
// add or subtract the lastly accessed data block.
//printf("xq to %lld %lld\n", (long long int) randomValue, (long long int) newPos);
newPos += randomValue;
if (newPos > r.lastFileffset){
newPos = newPos % r.lastFileffset;
}
MYlseek(fd, newPos, SEEK_SET);
return newPos;
}
}
}
typedef ssize_t(*iooperation) (int fd, void *buf, size_t count);
static void runBenchmark(int fd, double * times, double * start_times, size_t repeats, off_t * offsets){
Timer t;
iooperation op;
if (o.isRead){
op = read;
}else{
op = (iooperation) write;
}
size_t ret;
int64_t memPos;
initMemPos();
for (size_t i = 0 ; i < repeats; i++){
timerStart(& t);
memPos = pickNextMemPos();
off_t offset = setNextFilePos(fd);
#ifdef DEBUG
printf("Pos mem:%llu file:%llu\n", (long long unsigned) memPos, (long long unsigned) lseek(fd, 0, SEEK_CUR));
#endif
ret = op(fd, r.buff + memPos, o.accessSize);
checkIOError(o.accessSize, ret);
times[i] = timerEnd(& t);
start_times[i] = timeSinceStart(t);
offsets[i] = offset;
}
}
void print_data(char * buff){
if(rank == 0){
printf("%d: %s", 0, buff);
for(int i=1; i < size; i++){
MPI_Recv(buff, 4096, MPI_BYTE, i, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
printf("%d: %s", i, buff);
}
}else{
MPI_Send(buff, 4096, MPI_BYTE, 0, 0, MPI_COMM_WORLD);
}
}
static void runBenchmarkWrapper(){
int flags = o.isRead ? O_RDONLY : O_WRONLY | O_CREAT;
int fd = MYopen(o.filename, flags, S_IRWXU);
// malloc space to remember our internal measurement
double * times = (double*) mmalloc(sizeof(double) * (o.maxRepeats + 1));
double * start_times = (double*) mmalloc(sizeof(double) * (o.maxRepeats + 1)); // last time is always sync
off_t * offsets = (off_t*) mmalloc(sizeof(off_t) * (o.maxRepeats + 1));
Timer totalRunTimer;
timerStart(& totalRunTimer);
// now choose the benchmark to run based on the configuration
// if sequential:
if (o.localityInFile == LOCALITY_SEQUENTIAL){
r.doneRepeats = r.fileSizeInByte / o.accessSize;
if (r.doneRepeats > o.maxRepeats){
r.doneRepeats = o.maxRepeats;
}
}else{
r.doneRepeats = o.maxRepeats;
}
// sanity check
if(r.doneRepeats == 0){
printf("ERROR: number of repeats == 0\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
if (rank == 0) {
timerStart(& start_time);
MPI_Bcast(& start_time, sizeof(start_time), MPI_BYTE, 0, MPI_COMM_WORLD);
}else{
MPI_Bcast(& start_time, sizeof(start_time), MPI_BYTE, 0, MPI_COMM_WORLD);
}
start_background_threads(rank, r.doneRepeats);
//Timer tmp;
//timerStart(& tmp);
//printf("%.10fs %ld %ld\n", timeSinceStart(tmp), start_time.tv_sec, start_time.tv_nsec);
MPI_Barrier(MPI_COMM_WORLD);
runBenchmark(fd, times, start_times, r.doneRepeats, offsets);
double syncTime = timerEnd(& totalRunTimer);
MPI_Barrier(MPI_COMM_WORLD);
Timer sync_only;
timerStart(& sync_only);
fsync(fd);
close(fd);
times[r.doneRepeats] = timerEnd(& sync_only);
start_times[r.doneRepeats] = timeSinceStart(sync_only);
double totalRuntime = timerEnd(& totalRunTimer);
stop_background_threads(rank);
char buff[4096];
sprintf(buff, "Runtime:%.12fs ops/s:%.2f MiB/s:%.2f repeats:%llu syncTime:%.12fs \n",
totalRuntime,
((float) r.doneRepeats) / totalRuntime,
((float) r.doneRepeats * o.accessSize) /1024.0 / 1024.0 / totalRuntime,
(long long unsigned) r.doneRepeats,
totalRuntime - syncTime
);
print_data(buff);
// print statistics about the individual measurements
char fname[100];
sprintf(fname, "out-%d.csv", rank);
FILE * out = fopen(fname, "w");
fprintf(out, "start_time, duration, \n");
for (size_t i = 1; i < r.doneRepeats + 1; i++){
fprintf(out, "%.9f,%.12f\n", start_times[i], times[i]);
}
fclose(out);
if (o.printOffsets){
printf("Offset per operation: %llu", (long long unsigned) offsets[0]);
for (size_t i = 1; i < r.doneRepeats; i++){
printf(", %llu", (long long unsigned) offsets[i]);
}
printf("\n");
}
free(times);
free(offsets);
}
static void parseLocality(const char * str, enum locality * locality, size_t * out_arg, size_t * out_arg2){
*out_arg = 0;
*out_arg2 = 0;
if (strncmp(str, "off0", 5) == 0){
*locality = LOCALITY_OFF0;
return ;
}
if (strncmp(str, "seq", 4) == 0){
*locality = LOCALITY_SEQUENTIAL;
return ;
}
if (strncmp(str, "rnd", 4) == 0){
*locality = LOCALITY_RANDOM;
return ;
}
if (strncmp(str, "rnd", 3) == 0){
*out_arg = atoll(& str[3]);
*locality = LOCALITY_RANDOM_NEARBY;
return;
}
if (strncmp(str, "stride", 6) == 0){
*out_arg = atoll(& str[6]);
if (strstr(& str[6], ",") != NULL){
// we also have a random value
*locality = LOCALITY_RANDOM_NEARBY_STRIDE;
*out_arg2 = atoll(strstr(& str[6], ",") + 1);
}else{
*locality = LOCALITY_STRIDED;
}
return;
}
if (strncmp(str, "reverse", 7) == 0){
*out_arg = atoll(& str[7]);
*locality = LOCALITY_REVERSE_STRIDED;
return;
}
printf("Error cannot parse locality %s\n", str);
MPI_Abort(MPI_COMM_WORLD, 1);
}
int main(int argc, char ** argv){
MPI_Init(& argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, & size);
MPI_Comm_rank(MPI_COMM_WORLD, & rank);
if (argc < 16 && rank == 0){
printf("Synopsis: %s <file> <memoryBufferInMiB> <fileSizeInMiB> <MaxRepeats> <Truncate=0|1> <accessSize> <localityInMemory> <localityInFile> <preallocateMemoryRemainsInMiB or all=0> <preWriteMemBuffer> <preWriteFile> <R|W ReadOrWrite> <SEED> <WaitForProperSize=0|1> <devicename e.g. sdc>\n", argv[0]);
printf("Locality:\n");
printf("off0: always start at offset 0 == 0\n");
printf("seq: Sequential == 1\n");
printf("rnd: Random == 2\n");
printf("rndX: Random with max X delta offset \n");
printf("strideX: sequential + add hole of size X with X=0 is seq\n");
printf("strideX,Y: sequential with stride X and y as +-randomOffset\n");
printf("reverseX: inverse sequential + add hole of size X\n");
printf("PreWrite means if the memory buffer or File should be completely written with the given size before doing any test\n");
printf("programversion:%s\n", VERSION);
MPI_Abort(MPI_COMM_WORLD, 1);
}
// prefix rank
o.filename = malloc(10+strlen(argv[1]));
sprintf(o.filename, "%s-%d", argv[1], rank);
r.outputFile = stdout; //fopen(argv[2], "w");
o.memoryBufferInMiB = atoll(argv[2]);
o.fileSizeInMiB = atoll(argv[3]);
o.maxRepeats = atoll(argv[4]);
o.truncate = atoi(argv[5]);
o.accessSize = atoll(argv[6]);
parseLocality(argv[7], & o.localityInMemory, & o.localityMemParameter, & o.localityMemParameter2);
parseLocality(argv[8], & o.localityInFile, & o.localityFileParameter, & o.localityFileParameter2);
o.preallocateMemoryInMiB = atoll(argv[9]);
o.preWriteMem = atoi(argv[10]);
o.preWriteFile = atoi(argv[11]);
o.isRead = (argv[12][0] == 'R');
r.curMemPosition = 0;
int seed = atoi(argv[13]);
if (seed != -1){
srand(seed);
}else{
printf("Using PID as seed\n");
srand((int) getpid());
}
o.isWaitForProperSize = atoi(argv[14]);
o.deviceName = argv[15];
if(rank == 0){
printf("%s file:%s memBuffer:%llu fileSizeInMiB:%llu maxRepeats:%llu truncate:%d accessSize:%llu localityMem:%d-%lld-%lld localityFile:%d-%lld-%lld preallocateMemoryInMiB:%llu preWriteMem:%d preWriteFile:%d isRead:%d seed:%s waitForProperSize:%d programversion:%s\n",
argv[0],
o.filename,
(long long unsigned) o.memoryBufferInMiB,
(long long unsigned) o.fileSizeInMiB,
(long long unsigned) o.maxRepeats,
o.truncate,
(long long unsigned) o.accessSize,
o.localityInMemory,
(long long unsigned) o.localityMemParameter,
(long long unsigned) o.localityMemParameter2,
o.localityInFile,
(long long unsigned) o.localityFileParameter,
(long long unsigned) o.localityFileParameter2,
(long long unsigned) o.preallocateMemoryInMiB,
o.preWriteMem,
o.preWriteFile,
o.isRead,
argv[13],
o.isWaitForProperSize,
VERSION
);
}
// preallocate file?
r.memBufferInBytes = o.memoryBufferInMiB*1024*1024;
r.fileSizeInByte = o.fileSizeInMiB*1024*1024;
r.lastMemOffset = r.memBufferInBytes - o.accessSize;
r.lastFileffset = r.fileSizeInByte - o.accessSize;
r.repeatsToMatchFileSize = r.fileSizeInByte / o.accessSize;
// now allocate memory buffer for I/O
r.buff = mmalloc(r.memBufferInBytes);
// prefill memory buffer if needed
if (o.preWriteMem){
memset(r.buff, 0, r.memBufferInBytes);
}
// prefill file if needed
if (o.truncate){
int fd = MYopen(o.filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRWXU);
close(fd);
}
if (o.preWriteFile){
size_t ret;
int fd = MYopen(o.filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRWXU);
size_t repeats = o.fileSizeInMiB / o.memoryBufferInMiB;
for(size_t i=0; i < repeats; i++){
ret = write(fd, r.buff, r.memBufferInBytes);
checkIOError(r.memBufferInBytes, ret);
}
size_t rest = (r.fileSizeInByte % r.memBufferInBytes);
ret = write(fd, r.buff, rest);
checkIOError(rest, ret);
close(fd);
}
if ( strcmp(o.filename, "/dev/zero") != 0 && ( o.isRead || o.isWaitForProperSize) ){
// check for validity of the file size.
struct stat statBlock;
int waitingIterations = 0;
while(waitingIterations < 30){
int ret = stat(o.filename, & statBlock);
if (ret != 0 || statBlock.st_size * 512 < r.fileSizeInByte ){
if (o.isWaitForProperSize){
printf("Warning: the file %s should have a size of at least %llu for read tests but has %llu \n", o.filename, (long long unsigned) r.fileSizeInByte, (long long unsigned) statBlock.st_size * 512);
sleep(1);
waitingIterations++;
}else{
printf("Fatal: the file %s should have a size of at least %llu for read tests but has %llu \n", o.filename, (long long unsigned) r.fileSizeInByte, (long long unsigned) statBlock.st_size * 512);
MPI_Abort(MPI_COMM_WORLD, 1);
}
}else{
break;
}
}
if (waitingIterations == 30){
printf("Fatal: the file %s should have a size of at least %llu for read tests but has %llu \n", o.filename, (long long unsigned) r.fileSizeInByte, (long long unsigned) statBlock.st_size * 512);
MPI_Abort(MPI_COMM_WORLD, 1);
}
if (waitingIterations > 0) {
printf("Warning, waited for %d seconds until file size has matched\n", waitingIterations);
}
// check for allocations
if ( statBlock.st_blocks * 512 < r.fileSizeInByte ){
printf("Warning: the file is sparse with only %llu bytes allocated\n", (long long unsigned) statBlock.st_blocks * 512);
}
}
if( o.localityMemParameter > r.lastMemOffset){
printf("Error the mem localization parameter is larger than the mem buffer\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
if( o.localityFileParameter > r.lastFileffset){
printf("Error the file localization parameter is larger than the file size\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
// now preallocate
if ( o.preallocateMemoryInMiB > 0){
preallocate(o.preallocateMemoryInMiB*1024);
}
r.doneRepeats = 0;
runBenchmarkWrapper();
dumpStats(rank, r.doneRepeats);
fflush(r.outputFile);
free(r.buff);
MPI_Finalize();
return 0;
}