From 1890aaaeb096b178a29cb79fa65e6c61b43acc66 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 18:19:48 +0100 Subject: [PATCH 01/11] Started to move IOR specific knowledge out of AIORI. For now, and compatibility, IOR options can still be set/internally accessed using the backends init_xfer_options. This should be removed in the long run to strip away this dependency. --- src/aiori-DUMMY.c | 63 ++++++++---- src/aiori-MMAP.c | 80 +++++++++------ src/aiori-MPIIO.c | 243 ++++++++++++++++++++++++++++---------------- src/aiori-POSIX.c | 66 ++++++------ src/aiori-S3.c | 12 +-- src/aiori.c | 96 +---------------- src/aiori.h | 64 ++++++------ src/ior-output.c | 6 -- src/ior.c | 108 +++++++------------- src/ior.h | 12 +-- src/mdtest.c | 19 ++-- src/parse_options.c | 40 +------- 12 files changed, 371 insertions(+), 438 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index f368c79..c58a128 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -46,12 +46,17 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val return help; } -static void *DUMMY_Create(char *testFileName, IOR_param_t * param) +static int count_init = 0; + +static void *DUMMY_Create(char *testFileName, int iorflags, void * param) { + if(count_init <= 0){ + ERR("DUMMY missing initialization in create\n"); + } if(verbose > 4){ fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); } - dummy_options_t * o = (dummy_options_t*) param->backend_options; + dummy_options_t * o = (dummy_options_t*) param; if (o->delay_creates){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = { o->delay_creates / 1000 / 1000, 1000l * (o->delay_creates % 1000000)}; @@ -61,15 +66,18 @@ static void *DUMMY_Create(char *testFileName, IOR_param_t * param) return current++; } -static void *DUMMY_Open(char *testFileName, IOR_param_t * param) +static void *DUMMY_Open(char *testFileName, int flags, void * param) { + if(count_init <= 0){ + ERR("DUMMY missing initialization in open\n"); + } if(verbose > 4){ fprintf(out_logfile, "DUMMY open: %s = %p\n", testFileName, current); } return current++; } -static void DUMMY_Fsync(void *fd, IOR_param_t * param) +static void DUMMY_Fsync(void *fd, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -77,18 +85,18 @@ static void DUMMY_Fsync(void *fd, IOR_param_t * param) } -static void DUMMY_Sync(IOR_param_t * param) +static void DUMMY_Sync(void * param) { } -static void DUMMY_Close(void *fd, IOR_param_t * param) +static void DUMMY_Close(void *fd, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, IOR_param_t * param) +static void DUMMY_Delete(char *testFileName, void * param) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -100,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -108,11 +116,11 @@ static IOR_offset_t DUMMY_GetFileSize(IOR_param_t * test, MPI_Comm testComm, cha return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, IOR_param_t * param){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, void * param){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } - dummy_options_t * o = (dummy_options_t*) param->backend_options; + dummy_options_t * o = (dummy_options_t*) param; if (o->delay_xfer){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = {o->delay_xfer / 1000 / 1000, 1000l * (o->delay_xfer % 1000000)}; @@ -122,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, IOR_param_t * param){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * param){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -132,26 +140,40 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, IOR_param return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, IOR_param_t * param){ +static int DUMMY_mkdir (const char *path, mode_t mode, void * param){ return 0; } -static int DUMMY_rmdir (const char *path, IOR_param_t * param){ +static int DUMMY_rmdir (const char *path, void * param){ return 0; } -static int DUMMY_access (const char *path, int mode, IOR_param_t * param){ +static int DUMMY_access (const char *path, int mode, void * param){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){ +static int DUMMY_stat (const char *path, struct stat *buf, void * param){ return 0; } -static int DUMMY_check_params(IOR_param_t * test){ - return 1; +static int DUMMY_check_params(void * test){ + return 0; } +static void DUMMY_init(void * options){ + WARN("DUMMY initialized"); + count_init++; +} + +static void DUMMY_final(void * options){ + WARN("DUMMY finalized"); + if(count_init <= 0){ + ERR("DUMMY invalid finalization\n"); + } + count_init--; +} + + ior_aiori_t dummy_aiori = { .name = "DUMMY", .name_legacy = NULL, @@ -168,11 +190,10 @@ ior_aiori_t dummy_aiori = { .rmdir = DUMMY_rmdir, .access = DUMMY_access, .stat = DUMMY_stat, - .initialize = NULL, - .finalize = NULL, + .initialize = DUMMY_init, + .finalize = DUMMY_final, .get_options = DUMMY_options, - .enable_mdtest = true, .check_params = DUMMY_check_params, .sync = DUMMY_Sync, - .enable_mdtest = true + .enable_mdtest = true }; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 7be860a..0b55557 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,14 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, IOR_param_t *); -static void *MMAP_Open(char *, IOR_param_t *); +static void *MMAP_Create(char *, int flags, void *); +static void *MMAP_Open(char *, int flags, void *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void MMAP_Close(void *, IOR_param_t *); -static void MMAP_Fsync(void *, IOR_param_t *); + IOR_offset_t, void *); +static void MMAP_Close(void *, void *); +static void MMAP_Fsync(void *, void *); static option_help * MMAP_options(void ** init_backend_options, void * init_values); - +static void MMAP_init_xfer_options(IOR_param_t * params); +static int MMAP_check_params(void * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -43,10 +44,12 @@ ior_aiori_t mmap_aiori = { .xfer = MMAP_Xfer, .close = MMAP_Close, .delete = POSIX_Delete, + .init_xfer_options = MMAP_init_xfer_options, .get_version = aiori_get_version, .fsync = MMAP_Fsync, .get_file_size = POSIX_GetFileSize, .get_options = MMAP_options, + .check_params = MMAP_check_params }; /***************************** F U N C T I O N S ******************************/ @@ -79,25 +82,37 @@ static option_help * MMAP_options(void ** init_backend_options, void * init_valu return help; } -static void ior_mmap_file(int *file, IOR_param_t *param) +static IOR_param_t * ior_param = NULL; + +static void MMAP_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int MMAP_check_params(void * options){ + if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) + ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); + return 0; +} + +static void ior_mmap_file(int *file, int mflags, void *param) { int flags = PROT_READ; - IOR_offset_t size = param->expectedAggFileSize; + IOR_offset_t size = ior_param->expectedAggFileSize; - if (param->open == WRITE) + if (mflags & IOR_WRONLY || mflags & IOR_RDWR) flags |= PROT_WRITE; - mmap_options_t *o = (mmap_options_t*) param->backend_options; + mmap_options_t *o = (mmap_options_t*) param; o->mmap_ptr = mmap(NULL, size, flags, MAP_SHARED, *file, 0); if (o->mmap_ptr == MAP_FAILED) ERR("mmap() failed"); - if (param->randomOffset) + if (ior_param->randomOffset) flags = POSIX_MADV_RANDOM; else flags = POSIX_MADV_SEQUENTIAL; - + if(o->madv_pattern){ if (posix_madvise(o->mmap_ptr, size, flags) != 0) ERR("madvise() failed"); @@ -114,26 +129,25 @@ static void ior_mmap_file(int *file, IOR_param_t *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, IOR_param_t * param) +static void *MMAP_Create(char *testFileName, int flags, void * param) { int *fd; - fd = POSIX_Create(testFileName, param); - if (ftruncate(*fd, param->expectedAggFileSize) != 0) + fd = POSIX_Create(testFileName, flags, param); + if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) ERR("ftruncate() failed"); - ior_mmap_file(fd, param); + ior_mmap_file(fd, flags, param); return ((void *)fd); } /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, IOR_param_t * param) +static void *MMAP_Open(char *testFileName, int flags, void * param) { int *fd; - - fd = POSIX_Open(testFileName, param); - ior_mmap_file(fd, param); + fd = POSIX_Open(testFileName, flags, param); + ior_mmap_file(fd, flags, param); return ((void *)fd); } @@ -141,19 +155,19 @@ static void *MMAP_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; + mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + param->offset, buffer, length); + memcpy(o->mmap_ptr + ior_param->offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + param->offset, length); + memcpy(buffer, o->mmap_ptr + ior_param->offset, length); } - if (param->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + param->offset, length, MS_SYNC) != 0) + if (ior_param->fsyncPerWrite == TRUE) { + if (msync(o->mmap_ptr + ior_param->offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + param->offset, length, + if (posix_madvise(o->mmap_ptr + ior_param->offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } @@ -163,20 +177,20 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, IOR_param_t * param) +static void MMAP_Fsync(void *fd, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; - if (msync(o->mmap_ptr, param->expectedAggFileSize, MS_SYNC) != 0) + mmap_options_t *o = (mmap_options_t*) param; + if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) EWARN("msync() failed"); } /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, IOR_param_t * param) +static void MMAP_Close(void *fd, void * param) { - mmap_options_t *o = (mmap_options_t*) param->backend_options; - if (munmap(o->mmap_ptr, param->expectedAggFileSize) != 0) + mmap_options_t *o = (mmap_options_t*) param; + if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) ERR("munmap failed"); o->mmap_ptr = NULL; POSIX_Close(fd, param); diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 04c10be..443230b 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,23 +31,61 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, IOR_param_t *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, void *); -static void *MPIIO_Create(char *, IOR_param_t *); -static void *MPIIO_Open(char *, IOR_param_t *); +static void *MPIIO_Create(char *, int iorflags, void *); +static void *MPIIO_Open(char *, int flags, void *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void MPIIO_Close(void *, IOR_param_t *); + IOR_offset_t, void *); +static void MPIIO_Close(void *, void *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, IOR_param_t *); - +static void MPIIO_Fsync(void *, void *); +static void MPIIO_init_xfer_options(IOR_param_t * params); +static int MPIIO_check_params(void * options); /************************** D E C L A R A T I O N S ***************************/ +typedef struct { + int dry_run; + int showHints; /* show hints */ + int useFileView; /* use MPI_File_set_view */ + int preallocate; /* preallocate file size */ + int useSharedFilePointer; /* use shared file pointer */ + int useStridedDatatype; /* put strided access into datatype */ + char * hintsFileName; /* full name for hints file */ +} mpiio_options_t; + +static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ + mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); + if (init_values != NULL){ + memcpy(o, init_values, sizeof(mpiio_options_t)); + }else{ + memset(o, 0, sizeof(mpiio_options_t)); + } + *init_backend_options = o; + + option_help h [] = { + {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, + {0, "mpiio.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, + {0, "mpiio.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, + {0, "mpiio.preallocate", "Preallocate file size", OPTION_FLAG, 'd', & o->preallocate}, + {0, "mpiio.useStridedDatatype", "put strided access into datatype [not working]", OPTION_FLAG, 'd', & o->useStridedDatatype}, + //{'P', NULL, "useSharedFilePointer -- use shared file pointer [not working]", OPTION_FLAG, 'd', & params->useSharedFilePointer}, + {0, "mpiio.useFileView", "Use MPI_File_set_view", OPTION_FLAG, 'd', & o->useFileView}, + LAST_OPTION + }; + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} + + ior_aiori_t mpiio_aiori = { .name = "MPIIO", .name_legacy = NULL, .create = MPIIO_Create, + .get_options = MPIIO_options, + .init_xfer_options = MPIIO_init_xfer_options, .open = MPIIO_Open, .xfer = MPIIO_Xfer, .close = MPIIO_Close, @@ -60,16 +98,46 @@ ior_aiori_t mpiio_aiori = { .rmdir = aiori_posix_rmdir, .access = MPIIO_Access, .stat = aiori_posix_stat, + .check_params = MPIIO_check_params }; /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void MPIIO_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int MPIIO_check_params(void * module_options){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if ((param->useFileView == TRUE) + && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ + &&((ior_param->numTasks * ior_param->blockSize) > + (2 * (IOR_offset_t) GIBIBYTE))) + ERR("segment size must be < 2GiB"); + if (param->useSharedFilePointer) + ERR("shared file pointer not implemented"); + if (param->useStridedDatatype) + ERR("strided datatype not implemented"); + if (param->useStridedDatatype && (ior_param->blockSize < sizeof(IOR_size_t) + || ior_param->transferSize < + sizeof(IOR_size_t))) + ERR("need larger file size for strided datatype in MPIIO"); + if (ior_param->randomOffset && ior_param->collective) + ERR("random offset not available with collective MPIIO"); + if (ior_param->randomOffset && param->useFileView) + ERR("random offset not available with MPIIO fileviews"); + + return 0; +} /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, IOR_param_t *param) +int MPIIO_Access(const char *path, int mode, void *module_options) { - if(param->dryRun){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run){ return MPI_SUCCESS; } MPI_File fd; @@ -98,23 +166,21 @@ int MPIIO_Access(const char *path, int mode, IOR_param_t *param) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, IOR_param_t * param) +static void *MPIIO_Create(char *testFileName, int iorflags, void * module_options) { - if(param->dryRun){ - return 0; - } - return MPIIO_Open(testFileName, param); + return MPIIO_Open(testFileName, iorflags, module_options); } /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, IOR_param_t * param) +static void *MPIIO_Open(char *testFileName, int flags, void * module_options) { + mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, offsetFactor, tasksPerFile, - transfersPerBlock = param->blockSize / param->transferSize; + transfersPerBlock = ior_param->blockSize / ior_param->transferSize; struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; @@ -130,28 +196,28 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) /* set IOR file flags to MPIIO flags */ /* -- file open flags -- */ - if (param->openFlags & IOR_RDONLY) { + if (flags & IOR_RDONLY) { fd_mode |= MPI_MODE_RDONLY; } - if (param->openFlags & IOR_WRONLY) { + if (flags & IOR_WRONLY) { fd_mode |= MPI_MODE_WRONLY; } - if (param->openFlags & IOR_RDWR) { + if (flags & IOR_RDWR) { fd_mode |= MPI_MODE_RDWR; } - if (param->openFlags & IOR_APPEND) { + if (flags & IOR_APPEND) { fd_mode |= MPI_MODE_APPEND; } - if (param->openFlags & IOR_CREAT) { + if (flags & IOR_CREAT) { fd_mode |= MPI_MODE_CREATE; } - if (param->openFlags & IOR_EXCL) { + if (flags & IOR_EXCL) { fd_mode |= MPI_MODE_EXCL; } - if (param->openFlags & IOR_TRUNC) { + if (flags & IOR_TRUNC) { fprintf(stdout, "File truncation not implemented in MPIIO\n"); } - if (param->openFlags & IOR_DIRECT) { + if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); } @@ -162,7 +228,7 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) */ fd_mode |= MPI_MODE_UNIQUE_OPEN; - if (param->filePerProc) { + if (ior_param->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -181,13 +247,13 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) ShowHints(&mpiHints); fprintf(stdout, "}\n"); } - if(! param->dryRun){ + if(! param->dry_run){ MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd), "cannot open file: %s", testFileName); } /* show hints actually attached to file handle */ - if (rank == 0 && param->showHints && ! param->dryRun) { + if (rank == 0 && param->showHints && ! param->dry_run) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), @@ -198,29 +264,29 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) } /* preallocate space for file */ - if (param->preallocate && param->open == WRITE && ! param->dryRun) { + if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { MPI_CHECK(MPI_File_preallocate(*fd, - (MPI_Offset) (param->segmentCount + (MPI_Offset) (ior_param->segmentCount * - param->blockSize * - param->numTasks)), + ior_param->blockSize * + ior_param->numTasks)), "cannot preallocate file"); } /* create file view */ if (param->useFileView) { /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous - (param->transferSize / sizeof(IOR_size_t), - MPI_LONG_LONG_INT, ¶m->transferType), + (ior_param->transferSize / sizeof(IOR_size_t), + MPI_LONG_LONG_INT, &ior_param->transferType), "cannot create contiguous datatype"); - MPI_CHECK(MPI_Type_commit(¶m->transferType), + MPI_CHECK(MPI_Type_commit(&ior_param->transferType), "cannot commit datatype"); - if (param->filePerProc) { + if (ior_param->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % param->numTasks; - tasksPerFile = param->numTasks; + offsetFactor = (rank + rankOffset) % ior_param->numTasks; + tasksPerFile = ior_param->numTasks; } /* @@ -239,15 +305,15 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) (2, fileTypeStruct.globalSizes, fileTypeStruct.localSizes, fileTypeStruct.startIndices, MPI_ORDER_C, - param->transferType, ¶m->fileType), + ior_param->transferType, &ior_param->fileType), "cannot create subarray"); - MPI_CHECK(MPI_Type_commit(¶m->fileType), + MPI_CHECK(MPI_Type_commit(&ior_param->fileType), "cannot commit datatype"); - if(! param->dryRun){ + if(! param->dry_run){ MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, - param->transferType, - param->fileType, "native", + ior_param->transferType, + ior_param->fileType, "native", (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } @@ -261,14 +327,14 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below will get "assignment from incompatible pointer-type" warnings, if we only use this one set of signatures. */ - - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return length; int (MPIAPI * Access) (MPI_File, void *, int, @@ -319,7 +385,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(*(MPI_File *) fd, param->offset, param) < + if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < 0) { /* if unsuccessful */ length = -1; @@ -331,24 +397,24 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, * e.g., 'IOR -s 2 -b 32K -t 32K -a MPIIO -S' */ if (param->useStridedDatatype) { - length = param->segmentCount; + length = ior_param->segmentCount; } else { length = 1; } - if (param->collective) { + if (ior_param->collective) { /* individual, collective call */ MPI_CHECK(Access_all (*(MPI_File *) fd, buffer, length, - param->transferType, &status), + ior_param->transferType, &status), "cannot access collective"); } else { /* individual, noncollective call */ MPI_CHECK(Access (*(MPI_File *) fd, buffer, length, - param->transferType, &status), + ior_param->transferType, &status), "cannot access noncollective"); } - length *= param->transferSize; /* for return value in bytes */ + length *= ior_param->transferSize; /* for return value in bytes */ } } else { /* @@ -358,7 +424,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (*(MPI_File *) fd, param->offset, param) < 0) { + (*(MPI_File *) fd, ior_param->offset, param) < 0) { /* if unsuccessful */ length = -1; } else { @@ -374,32 +440,31 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, "useSharedFilePointer not implemented\n"); } } else { - if (param->collective) { + if (ior_param->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (*(MPI_File *) fd, param->offset, + (*(MPI_File *) fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (*(MPI_File *) fd, param->offset, + (*(MPI_File *) fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } } } - if((access == WRITE) && (param->fsyncPerWrite == TRUE)) - MPIIO_Fsync(fd, param); return (length); } /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, IOR_param_t * param) +static void MPIIO_Fsync(void *fdp, void * module_options) { - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return; if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS) EWARN("fsync() failed"); @@ -408,29 +473,31 @@ static void MPIIO_Fsync(void *fdp, IOR_param_t * param) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fd, IOR_param_t * param) +static void MPIIO_Close(void *fd, void * module_options) { - if(! param->dryRun){ + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(! param->dry_run){ MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file"); } - if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { - /* - * need to free the datatype, so done in the close process - */ - MPI_CHECK(MPI_Type_free(¶m->fileType), - "cannot free MPI file datatype"); - MPI_CHECK(MPI_Type_free(¶m->transferType), - "cannot free MPI transfer datatype"); - } + //if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { + // /* + // * need to free the datatype, so done in the close process + // */ + // MPI_CHECK(MPI_Type_free(¶m->fileType), + // "cannot free MPI file datatype"); + // MPI_CHECK(MPI_Type_free(¶m->transferType), + // "cannot free MPI transfer datatype"); + //} free(fd); } /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, IOR_param_t * param) +void MPIIO_Delete(char *testFileName, void * module_options) { - if(param->dryRun) + mpiio_options_t * param = (mpiio_options_t*) module_options; + if(param->dry_run) return; MPI_CHECKF(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL), "cannot delete file: %s", testFileName); @@ -452,36 +519,37 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - IOR_param_t * param) + void * module_options) { + mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; IOR_offset_t tempOffset; tempOffset = offset; - if (param->filePerProc) { + if (ior_param->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % param->numTasks; - tasksPerFile = param->numTasks; + offsetFactor = (rank + rankOffset) % ior_param->numTasks; + tasksPerFile = ior_param->numTasks; } if (param->useFileView) { /* recall that offsets in a file view are counted in units of transfer size */ - if (param->filePerProc) { - tempOffset = tempOffset / param->transferSize; + if (ior_param->filePerProc) { + tempOffset = tempOffset / ior_param->transferSize; } else { /* * this formula finds a file view offset for a task * from an absolute offset */ - tempOffset = ((param->blockSize / param->transferSize) + tempOffset = ((ior_param->blockSize / ior_param->transferSize) * (tempOffset / - (param->blockSize * tasksPerFile))) - + (((tempOffset % (param->blockSize * tasksPerFile)) - - (offsetFactor * param->blockSize)) - / param->transferSize); + (ior_param->blockSize * tasksPerFile))) + + (((tempOffset % (ior_param->blockSize * tasksPerFile)) + - (offsetFactor * ior_param->blockSize)) + / ior_param->transferSize); } } MPI_CHECK(MPI_File_seek(fd, tempOffset, MPI_SEEK_SET), @@ -493,17 +561,18 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(void * module_options, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + mpiio_options_t * test = (mpiio_options_t*) module_options; + if(test->dry_run) return 0; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; MPI_File fd; MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -519,7 +588,7 @@ IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 463a9c8..f7c9cd3 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,9 +69,11 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void POSIX_Fsync(void *, IOR_param_t *); -static void POSIX_Sync(IOR_param_t * ); + IOR_offset_t, void *); +static void POSIX_Fsync(void *, void *); +static void POSIX_Sync(void * ); +static void POSIX_init_xfer_options(IOR_param_t * params); + /************************** O P T I O N S *****************************/ typedef struct{ @@ -113,6 +115,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, + .init_xfer_options = POSIX_init_xfer_options, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -128,6 +131,11 @@ ior_aiori_t posix_aiori = { /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void POSIX_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} #ifdef HAVE_GPFS_FCNTL_H void gpfs_free_all_locks(int fd) @@ -151,7 +159,7 @@ void gpfs_free_all_locks(int fd) EWARNF("gpfs_fcntl(%d, ...) release all locks hint failed.", fd); } } -void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int access) +void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) { int rc; struct { @@ -175,7 +183,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, IOR_param_t *param, int acce } } -void gpfs_access_end(int fd, IOR_offset_t length, IOR_param_t *param, int access) +void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) { int rc; struct { @@ -318,7 +326,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, IOR_param_t * param) +void *POSIX_Create(char *testFileName, int flags, void * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -327,12 +335,12 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param) fd = (int *)malloc(sizeof(int)); if (fd == NULL) ERR("Unable to malloc file descriptor"); - posix_options_t * o = (posix_options_t*) param->backend_options; + posix_options_t * o = (posix_options_t*) param; if (o->direct_io == TRUE){ set_o_direct_flag(&fd_oflag); } - if(param->dryRun) + if(ior_param->dryRun) return 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H @@ -450,7 +458,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, IOR_param_t * param) +void *POSIX_Open(char *testFileName, int flags, void * param) { int fd_oflag = O_BINARY; int *fd; @@ -459,13 +467,13 @@ void *POSIX_Open(char *testFileName, IOR_param_t * param) if (fd == NULL) ERR("Unable to malloc file descriptor"); - posix_options_t * o = (posix_options_t*) param->backend_options; + posix_options_t * o = (posix_options_t*) param; if (o->direct_io == TRUE) set_o_direct_flag(&fd_oflag); fd_oflag |= O_RDWR; - if(param->dryRun) + if(ior_param->dryRun) return 0; *fd = open64(testFileName, fd_oflag); @@ -496,7 +504,7 @@ void *POSIX_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -504,7 +512,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, long long rc; int fd; - if(param->dryRun) + if(ior_param->dryRun) return length; fd = *(int *)file; @@ -517,8 +525,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* seek to offset */ - if (lseek64(fd, param->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, param->offset); + if (lseek64(fd, ior_param->offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, ior_param->offset); while (remaining > 0) { /* write/read file */ @@ -527,20 +535,20 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, fprintf(stdout, "task %d writing to offset %lld\n", rank, - param->offset + length - remaining); + ior_param->offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (param->fsyncPerWrite == TRUE) + if (ior_param->fsyncPerWrite == TRUE) POSIX_Fsync(&fd, param); } else { /* READ or CHECK */ if (verbose >= VERBOSE_4) { fprintf(stdout, "task %d reading from offset %lld\n", rank, - param->offset + length - remaining); + ior_param->offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -556,8 +564,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, rank, access == WRITE ? "write()" : "read()", rc, remaining, - param->offset + length - remaining); - if (param->singleXferAttempt == TRUE) + ior_param->offset + length - remaining); + if (ior_param->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); if (xferRetries > MAX_RETRY) @@ -580,14 +588,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, IOR_param_t * param) +static void POSIX_Fsync(void *fd, void * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(IOR_param_t * param) +static void POSIX_Sync(void * param) { int ret = system("sync"); if (ret != 0){ @@ -599,9 +607,9 @@ static void POSIX_Sync(IOR_param_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, IOR_param_t * param) +void POSIX_Close(void *fd, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; if (close(*(int *)fd) != 0) ERRF("close(%d) failed", *(int *)fd); @@ -611,9 +619,9 @@ void POSIX_Close(void *fd, IOR_param_t * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, IOR_param_t * param) +void POSIX_Delete(char *testFileName, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; if (unlink(testFileName) != 0){ EWARNF("[RANK %03d]: unlink() of file \"%s\" failed\n", @@ -624,10 +632,10 @@ void POSIX_Delete(char *testFileName, IOR_param_t * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + if(ior_param->dryRun) return 0; struct stat stat_buf; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; @@ -637,7 +645,7 @@ IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, } aggFileSizeFromStat = stat_buf.st_size; - if (test->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-S3.c b/src/aiori-S3.c index 2c9a9af..a060646 100755 --- a/src/aiori-S3.c +++ b/src/aiori-S3.c @@ -157,8 +157,8 @@ static void EMC_Close(void*, IOR_param_t*); static void S3_Delete(char*, IOR_param_t*); static void S3_Fsync(void*, IOR_param_t*); static IOR_offset_t S3_GetFileSize(IOR_param_t*, MPI_Comm, char*); -static void S3_init(); -static void S3_finalize(); +static void S3_init(void * options); +static void S3_finalize(void * options); static int S3_check_params(IOR_param_t *); @@ -218,14 +218,14 @@ ior_aiori_t s3_emc_aiori = { }; -static void S3_init(){ +static void S3_init(void * options){ /* This is supposed to be done before *any* threads are created. * Could MPI_Init() create threads (or call multi-threaded * libraries)? We'll assume so. */ AWS4C_CHECK( aws_init() ); } -static void S3_finalize(){ +static void S3_finalize(void * options){ /* done once per program, after exiting all threads. * NOTE: This fn doesn't return a value that can be checked for success. */ aws_cleanup(); @@ -241,10 +241,10 @@ static int S3_check_params(IOR_param_t * test){ if (Nto1 && (s != 1) && (b != t)) { ERR("N:1 (strided) requires xfer-size == block-size"); - return 0; + return 1; } - return 1; + return 0; } /* modelled on similar macros in iordef.h */ diff --git a/src/aiori.c b/src/aiori.c index 71f99d1..592c503 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_para return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param) +int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, IOR_param_t * param) +int aiori_posix_rmdir (const char *path, void * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, IOR_param_t * param) +int aiori_posix_access (const char *path, int mode, void * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param) +int aiori_posix_stat (const char *path, struct stat *buf, void * module_options) { return stat (path, buf); } @@ -202,92 +202,6 @@ char* aiori_get_version() return ""; } -static bool is_initialized = false; - -static void init_or_fini_internal(const ior_aiori_t *test_backend, - const bool init) -{ - if (init) - { - if (test_backend->initialize) - test_backend->initialize(); - } - else - { - if (test_backend->finalize) - test_backend->finalize(); - } -} - -static void init_or_fini(IOR_test_t *tests, const bool init) -{ - /* Sanity check, we were compiled with SOME backend, right? */ - if (0 == aiori_count ()) { - ERR("No IO backends compiled into aiori. " - "Run 'configure --with-', and recompile."); - } - - /* Pointer to the initialize of finalize function */ - - - /* if tests is NULL, initialize or finalize all available backends */ - if (tests == NULL) - { - for (ior_aiori_t **tmp = available_aiori ; *tmp != NULL; ++tmp) - init_or_fini_internal(*tmp, init); - - return; - } - - for (IOR_test_t *t = tests; t != NULL; t = t->next) - { - IOR_param_t *params = &t->params; - assert(params != NULL); - - const ior_aiori_t *test_backend = params->backend; - assert(test_backend != NULL); - - init_or_fini_internal(test_backend, init); - } -} - - -/** - * Initialize IO backends. - * - * @param[in] tests Pointers to the first test - * - * This function initializes all backends which will be used. If tests is NULL - * all available backends are initialized. - */ -void aiori_initialize(IOR_test_t *tests) -{ - if (is_initialized) - return; - - init_or_fini(tests, true); - - is_initialized = true; -} - -/** - * Finalize IO backends. - * - * @param[in] tests Pointers to the first test - * - * This function finalizes all backends which were used. If tests is NULL - * all available backends are finialized. - */ -void aiori_finalize(IOR_test_t *tests) -{ - if (!is_initialized) - return; - - is_initialized = false; - - init_or_fini(tests, false); -} - const ior_aiori_t *aiori_select (const char *api) { char warn_str[256] = {0}; diff --git a/src/aiori.h b/src/aiori.h index 4d416c2..4dd2eed 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -67,27 +67,31 @@ typedef struct ior_aiori_statfs { typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, IOR_param_t *); + void *(*create)(char *, int iorflags, void *); int (*mknod)(char *); - void *(*open)(char *, IOR_param_t *); + void *(*open)(char *, int iorflags, void *); + /* + Allow to set generic transfer options that shall be applied to any subsequent IO call. + */ + void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); - void (*close)(void *, IOR_param_t *); - void (*delete)(char *, IOR_param_t *); + IOR_offset_t, void *); + void (*close)(void *, void *); + void (*delete)(char *, void *); char* (*get_version)(void); - void (*fsync)(void *, IOR_param_t *); - IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, IOR_param_t * param); - int (*mkdir) (const char *path, mode_t mode, IOR_param_t * param); - int (*rmdir) (const char *path, IOR_param_t * param); - int (*access) (const char *path, int mode, IOR_param_t * param); - int (*stat) (const char *path, struct stat *buf, IOR_param_t * param); - void (*initialize)(void); /* called once per program before MPI is started */ - void (*finalize)(void); /* called once per program after MPI is shutdown */ + void (*fsync)(void *, void *); + IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); + int (*mkdir) (const char *path, mode_t mode, void * module_options); + int (*rmdir) (const char *path, void * module_options); + int (*access) (const char *path, int mode, void * module_options); + int (*stat) (const char *path, struct stat *buf, void * module_options); + void (*initialize)(void * options); /* called once per program before MPI is started */ + void (*finalize)(void * options); /* called once per program after MPI is shutdown */ option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ bool enable_mdtest; - int (*check_params)(IOR_param_t *); /* check if the provided parameters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(IOR_param_t * ); /* synchronize every pending operation for this storage */ + int (*check_params)(void *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(void * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { @@ -112,8 +116,6 @@ extern ior_aiori_t rados_aiori; extern ior_aiori_t cephfs_aiori; extern ior_aiori_t gfarm_aiori; -void aiori_initialize(IOR_test_t * tests); -void aiori_finalize(IOR_test_t * tests); const ior_aiori_t *aiori_select (const char *api); int aiori_count (void); void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type); @@ -125,25 +127,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t * param); -int aiori_posix_mkdir (const char *path, mode_t mode, IOR_param_t * param); -int aiori_posix_rmdir (const char *path, IOR_param_t * param); -int aiori_posix_access (const char *path, int mode, IOR_param_t * param); -int aiori_posix_stat (const char *path, struct stat *buf, IOR_param_t * param); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); +int aiori_posix_rmdir (const char *path, void * module_options); +int aiori_posix_access (const char *path, int mode, void * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); -void *POSIX_Create(char *testFileName, IOR_param_t * param); +void *POSIX_Create(char *testFileName, int flags, void * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, IOR_param_t * param); -IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, IOR_param_t * param); -void POSIX_Close(void *fd, IOR_param_t * param); +void *POSIX_Open(char *testFileName, int flags, void * module_options); +IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, void * module_options); +void POSIX_Close(void *fd, void * module_options); option_help * POSIX_options(void ** init_backend_options, void * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, IOR_param_t * param); -IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm, +void MPIIO_Delete(char *testFileName, void * module_options); +IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); -int MPIIO_Access(const char *, int, IOR_param_t *); +int MPIIO_Access(const char *, int, void *); #endif /* not _AIORI_H */ diff --git a/src/ior-output.c b/src/ior-output.c index 01136fb..3bb8fd7 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -337,7 +337,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyVal("api", test->api); PrintKeyVal("platform", test->platform); PrintKeyVal("testFileName", test->testFileName); - PrintKeyVal("hintsFileName", test->hintsFileName); PrintKeyValInt("deadlineForStonewall", test->deadlineForStonewalling); PrintKeyValInt("stoneWallingWearOut", test->stoneWallingWearOut); PrintKeyValInt("maxTimeDuration", test->maxTimeDuration); @@ -355,7 +354,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("fsync", test->fsync); PrintKeyValInt("fsyncperwrite", test->fsyncPerWrite); PrintKeyValInt("useExistingTestFile", test->useExistingTestFile); - PrintKeyValInt("showHints", test->showHints); PrintKeyValInt("uniqueDir", test->uniqueDir); PrintKeyValInt("individualDataSets", test->individualDataSets); PrintKeyValInt("singleXferAttempt", test->singleXferAttempt); @@ -368,12 +366,8 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("randomOffset", test->randomOffset); PrintKeyValInt("checkWrite", test->checkWrite); PrintKeyValInt("checkRead", test->checkRead); - PrintKeyValInt("preallocate", test->preallocate); - PrintKeyValInt("useFileView", test->useFileView); PrintKeyValInt("setAlignment", test->setAlignment); PrintKeyValInt("storeFileOffset", test->storeFileOffset); - PrintKeyValInt("useSharedFilePointer", test->useSharedFilePointer); - PrintKeyValInt("useStridedDatatype", test->useStridedDatatype); PrintKeyValInt("keepFile", test->keepFile); PrintKeyValInt("keepFileWithError", test->keepFileWithError); PrintKeyValInt("quitOnError", test->quitOnError); diff --git a/src/ior.c b/src/ior.c index 05070b0..206a9f4 100755 --- a/src/ior.c +++ b/src/ior.c @@ -58,6 +58,28 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, void *fd, const int access, IOR_io_buffers *ioBuffers); +static void test_initialize(IOR_test_t * test){ + verbose = test->params.verbose; + backend = test->params.backend; + if (rank == 0 && verbose >= VERBOSE_0) { + ShowTestStart(& test->params); + } + if(backend->initialize){ + backend->initialize(test->params.backend_options); + } + if(backend->init_xfer_options){ + backend->init_xfer_options(test); + } +} + +static void test_finalize(IOR_test_t * test){ + backend = test->params.backend; + if(backend->finalize){ + backend->finalize(test->params.backend_options); + } +} + + IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out){ IOR_test_t *tests_head; IOR_test_t *tptr; @@ -76,17 +98,12 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - aiori_initialize(tptr); + test_initialize(tptr); totalErrorCount = 0; - verbose = tptr->params.verbose; - backend = tptr->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - ShowTestStart(&tptr->params); - } TestIoSys(tptr); tptr->results->errors = totalErrorCount; ShowTestEnd(tptr); - aiori_finalize(tptr); + test_finalize(tptr); } PrintLongSummaryAllTests(tests_head); @@ -125,18 +142,11 @@ int ior_main(int argc, char **argv) InitTests(tests_head, mpi_comm_world); verbose = tests_head->params.verbose; - aiori_initialize(tests_head); // this is quite suspicious, likely an error when multiple tests need to be executed with different backends and options - PrintHeader(argc, argv); /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - verbose = tptr->params.verbose; - backend = tptr->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - backend = tptr->params.backend; - ShowTestStart(&tptr->params); - } + test_initialize(tptr); // This is useful for trapping a running MPI process. While // this is sleeping, run the script 'testing/hdfs/gdb.attach' @@ -148,6 +158,7 @@ int ior_main(int argc, char **argv) TestIoSys(tptr); ShowTestEnd(tptr); + test_finalize(tptr); } if (verbose < 0) @@ -158,8 +169,6 @@ int ior_main(int argc, char **argv) /* display finish time */ PrintTestEnds(); - aiori_finalize(tests_head); - MPI_CHECK(MPI_Finalize(), "cannot finalize MPI"); DestroyTests(tests_head); @@ -180,10 +189,6 @@ void init_IOR_Param_t(IOR_param_t * p) assert (NULL != default_aiori); memset(p, 0, sizeof(IOR_param_t)); - - p->mode = IOR_IRUSR | IOR_IWUSR | IOR_IRGRP | IOR_IWGRP; - p->openFlags = IOR_RDWR | IOR_CREAT; - p->api = strdup(default_aiori); p->platform = strdup("HOST(OSTYPE)"); p->testFileName = strdup("testFile"); @@ -1338,7 +1343,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = WRITE; timer[0] = GetTimeStamp(); - fd = backend->create(testFileName, params); + fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1412,7 +1417,7 @@ static void TestIoSys(IOR_test_t *test) GetTestFileName(testFileName, params); params->open = WRITECHECK; - fd = backend->open(testFileName, params); + fd = backend->open(testFileName, IOR_RDONLY, params); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers); backend->close(fd, params); rankOffset = 0; @@ -1484,7 +1489,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = READ; timer[0] = GetTimeStamp(); - fd = backend->open(testFileName, params); + fd = backend->open(testFileName, IOR_RDONLY, params); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1613,11 +1618,6 @@ static void ValidateTests(IOR_param_t * test) && (test->blockSize < sizeof(IOR_size_t) || test->transferSize < sizeof(IOR_size_t))) ERR("block/transfer size may not be smaller than IOR_size_t for NCMPI"); - if ((test->useFileView == TRUE) - && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ - &&((test->numTasks * test->blockSize) > - (2 * (IOR_offset_t) GIBIBYTE))) - ERR("segment size must be < 2GiB"); if ((strcasecmp(test->api, "POSIX") != 0) && test->singleXferAttempt) WARN_RESET("retry only available in POSIX", test, &defaults, singleXferAttempt); @@ -1630,39 +1630,6 @@ static void ValidateTests(IOR_param_t * test) && (strcasecmp(test->api, "CEPHFS") != 0)) && test->fsync) WARN_RESET("fsync() not supported in selected backend", test, &defaults, fsync); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->preallocate) - WARN_RESET("preallocation only available in MPIIO", - test, &defaults, preallocate); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useFileView) - WARN_RESET("file view only available in MPIIO", - test, &defaults, useFileView); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useSharedFilePointer) - WARN_RESET("shared file pointer only available in MPIIO", - test, &defaults, useSharedFilePointer); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->useSharedFilePointer) - WARN_RESET("shared file pointer not implemented", - test, &defaults, useSharedFilePointer); - if ((strcasecmp(test->api, "MPIIO") != 0) && test->useStridedDatatype) - WARN_RESET("strided datatype only available in MPIIO", - test, &defaults, useStridedDatatype); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->useStridedDatatype) - WARN_RESET("strided datatype not implemented", - test, &defaults, useStridedDatatype); - if ((strcasecmp(test->api, "MPIIO") == 0) - && test->useStridedDatatype && (test->blockSize < sizeof(IOR_size_t) - || test->transferSize < - sizeof(IOR_size_t))) - ERR("need larger file size for strided datatype in MPIIO"); - if ((strcasecmp(test->api, "POSIX") == 0) && test->showHints) - WARN_RESET("hints not available in POSIX", - test, &defaults, showHints); - if ((strcasecmp(test->api, "POSIX") == 0) && test->collective) - WARN_RESET("collective not available in POSIX", - test, &defaults, collective); - if ((strcasecmp(test->api, "MMAP") == 0) && test->fsyncPerWrite - && (test->transferSize & (sysconf(_SC_PAGESIZE) - 1))) - ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); - /* parameter consitency */ if (test->reorderTasks == TRUE && test->reorderTasksRandom == TRUE) ERR("Both Constant and Random task re-ordering specified. Choose one and resubmit"); @@ -1676,14 +1643,6 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with read check option (use write check)"); if (test->randomOffset && test->storeFileOffset) ERR("random offset not available with store file offset option)"); - - - if ((strcasecmp(test->api, "MPIIO") == 0) && test->randomOffset - && test->collective) - ERR("random offset not available with collective MPIIO"); - if ((strcasecmp(test->api, "MPIIO") == 0) && test->randomOffset - && test->useFileView) - ERR("random offset not available with MPIIO fileviews"); if ((strcasecmp(test->api, "HDF5") == 0) && test->randomOffset) ERR("random offset not available with HDF5"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->randomOffset) @@ -1719,8 +1678,11 @@ static void ValidateTests(IOR_param_t * test) /* allow the backend to validate the options */ if(test->backend->check_params){ + if(test->backend->init_xfer_options){ + test->backend->init_xfer_options(test); + } int check = test->backend->check_params(test); - if (check == 0){ + if (check){ ERR("The backend returned that the test parameters are invalid."); } } @@ -1870,9 +1832,11 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset FillBuffer(buffer, test, test->offset, pretendRank); } amtXferred = - backend->xfer(access, fd, buffer, transfer, test); + backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); + if (test->fsyncPerWrite) + backend->fsync(fd, test->backend_options); if (test->interIODelay > 0){ struct timespec wait = {test->interIODelay / 1000 / 1000, 1000l * (test->interIODelay % 1000000)}; nanosleep( & wait, NULL); diff --git a/src/ior.h b/src/ior.h index 758b048..14d6ddf 100755 --- a/src/ior.h +++ b/src/ior.h @@ -84,17 +84,15 @@ typedef struct { const struct ior_aiori * backend; char * debug; /* debug info string */ - unsigned int mode; /* file permissions */ - unsigned int openFlags; /* open flags (see also ) */ int referenceNumber; /* user supplied reference number */ char * api; /* API for I/O */ char * apiVersion; /* API version */ char * platform; /* platform type */ char * testFileName; /* full name for test */ char * testFileName_fppReadCheck;/* filename for fpp read check */ - char * hintsFileName; /* full name for hints file */ char * options; /* options string */ // intermediate options + int collective; /* collective I/O */ int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ @@ -119,17 +117,12 @@ typedef struct int keepFileWithError; /* don't delete the testfile with errors */ int errorFound; /* error found in data check */ int quitOnError; /* quit code when error in check */ - int collective; /* collective I/O */ IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ - int preallocate; /* preallocate file size */ - int useFileView; /* use MPI_File_set_view */ - int useSharedFilePointer; /* use shared file pointer */ - int useStridedDatatype; /* put strided access into datatype */ - int showHints; /* show hints */ + int summary_every_test; /* flag to print summary every test, not just at end */ int uniqueDir; /* use unique directory for each fpp */ int useExistingTestFile; /* do not delete test file before access */ @@ -144,7 +137,6 @@ typedef struct int verbose; /* verbosity */ int setTimeStampSignature; /* set time stamp signature */ unsigned int timeStampSignatureValue; /* value for time stamp signature */ - void * fd_fppReadCheck; /* additional fd for fpp read check */ int randomSeed; /* random seed for write/read check */ unsigned int incompressibleSeed; /* random seed for incompressible file creation */ int randomOffset; /* access is to random offsets */ diff --git a/src/mdtest.c b/src/mdtest.c index f82db1b..6d789f0 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -355,8 +355,6 @@ static void create_file (const char *path, uint64_t itemNum) { sprintf(curr_item, "%s/file.%s"LLU"", path, mk_name, itemNum); VERBOSE(3,5,"create_remove_items_helper (non-dirs create): curr_item is '%s'", curr_item); - param.openFlags = IOR_WRONLY; - if (make_node) { int ret; VERBOSE(3,5,"create_remove_items_helper : mknod..." ); @@ -369,7 +367,7 @@ static void create_file (const char *path, uint64_t itemNum) { } else if (collective_creates) { VERBOSE(3,5,"create_remove_items_helper (collective): open..." ); - aiori_fh = backend->open (curr_item, ¶m); + aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); if (NULL == aiori_fh) FAIL("unable to open file %s", curr_item); @@ -377,12 +375,10 @@ static void create_file (const char *path, uint64_t itemNum) { * !collective_creates */ } else { - param.openFlags |= IOR_CREAT; param.filePerProc = !shared_file; - param.mode = FILEMODE; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); - aiori_fh = backend->create (curr_item, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m.backend_options); if (NULL == aiori_fh) FAIL("unable to create file %s", curr_item); } @@ -449,9 +445,7 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 void *aiori_fh; //create files - param.openFlags = IOR_WRONLY | IOR_CREAT; - param.mode = FILEMODE; - aiori_fh = backend->create (curr_item, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); if (NULL == aiori_fh) { FAIL("unable to create file %s", curr_item); } @@ -713,8 +707,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { VERBOSE(3,5,"mdtest_read file: %s", item); /* open file for reading */ - param.openFlags = O_RDONLY; - aiori_fh = backend->open (item, ¶m); + aiori_fh = backend->open (item, O_RDONLY, ¶m); if (NULL == aiori_fh) { FAIL("unable to open file %s", item); } @@ -1972,7 +1965,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * MPI_Comm_size(testComm, &size); if (backend->initialize) - backend->initialize(); + backend->initialize(param.backend_options); pid = getpid(); uid = getuid(); @@ -2264,7 +2257,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } if (backend->finalize) - backend->finalize(); + backend->finalize(param.backend_options); return summary_table; } diff --git a/src/parse_options.c b/src/parse_options.c index 607d014..51a5d24 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -62,24 +62,6 @@ static void CheckRunSettings(IOR_test_t *tests) params->readFile = TRUE; params->writeFile = TRUE; } - - /* If only read or write is requested, then fix the default - * openFlags to not be open RDWR. It matters in the case - * of HDFS, which doesn't support opening RDWR. - * (We assume int-valued params are exclusively 0 or 1.) - */ - if ((params->openFlags & IOR_RDWR) - && ((params->readFile | params->checkRead | params->checkWrite) - ^ params->writeFile)) { - - params->openFlags &= ~(IOR_RDWR); - if (params->readFile | params->checkRead) { - params->openFlags |= IOR_RDONLY; - params->openFlags &= ~(IOR_CREAT|IOR_EXCL); - } - else - params->openFlags |= IOR_WRONLY; - } } } @@ -137,8 +119,6 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->platform = strdup(value); } else if (strcasecmp(option, "testfile") == 0) { params->testFileName = strdup(value); - } else if (strcasecmp(option, "hintsfilename") == 0) { - params->hintsFileName = strdup(value); } else if (strcasecmp(option, "deadlineforstonewalling") == 0) { params->deadlineForStonewalling = atoi(value); } else if (strcasecmp(option, "stoneWallingWearOut") == 0) { @@ -213,20 +193,8 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->verbose = atoi(value); } else if (strcasecmp(option, "settimestampsignature") == 0) { params->setTimeStampSignature = atoi(value); - } else if (strcasecmp(option, "collective") == 0) { - params->collective = atoi(value); - } else if (strcasecmp(option, "preallocate") == 0) { - params->preallocate = atoi(value); } else if (strcasecmp(option, "storefileoffset") == 0) { params->storeFileOffset = atoi(value); - } else if (strcasecmp(option, "usefileview") == 0) { - params->useFileView = atoi(value); - } else if (strcasecmp(option, "usesharedfilepointer") == 0) { - params->useSharedFilePointer = atoi(value); - } else if (strcasecmp(option, "usestrideddatatype") == 0) { - params->useStridedDatatype = atoi(value); - } else if (strcasecmp(option, "showhints") == 0) { - params->showHints = atoi(value); } else if (strcasecmp(option, "uniqueDir") == 0) { params->uniqueDir = atoi(value); } else if (strcasecmp(option, "useexistingtestfile") == 0) { @@ -472,7 +440,7 @@ option_help * createGlobalOptions(IOR_param_t * params){ {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & params->api}, {'A', NULL, "refNum -- user supplied reference number to include in the summary", OPTION_OPTIONAL_ARGUMENT, 'd', & params->referenceNumber}, {'b', NULL, "blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->blockSize}, - {'c', NULL, "collective -- collective I/O", OPTION_FLAG, 'd', & params->collective}, + {'c', "collective", "Use collective I/O", OPTION_FLAG, 'd', & params->collective}, {'C', NULL, "reorderTasks -- changes task ordering for readback (useful to avoid client cache)", OPTION_FLAG, 'd', & params->reorderTasks}, {'d', NULL, "interTestDelay -- delay between reps in seconds", OPTION_OPTIONAL_ARGUMENT, 'd', & params->interTestDelay}, {'D', NULL, "deadlineForStonewalling -- seconds before stopping write or read phase", OPTION_OPTIONAL_ARGUMENT, 'd', & params->deadlineForStonewalling}, @@ -489,7 +457,6 @@ option_help * createGlobalOptions(IOR_param_t * params){ * after all the arguments are in and we know which it keep. */ {'G', NULL, "setTimeStampSignature -- set value for time stamp signature/random seed", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setTimeStampSignature}, - {'H', NULL, "showHints -- show hints", OPTION_FLAG, 'd', & params->showHints}, {'i', NULL, "repetitions -- number of repetitions of test", OPTION_OPTIONAL_ARGUMENT, 'd', & params->repetitions}, {'I', NULL, "individualDataSets -- datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & params->individualDataSets}, {'j', NULL, "outlierThreshold -- warn on outlier N seconds from mean", OPTION_OPTIONAL_ARGUMENT, 'd', & params->outlierThreshold}, @@ -503,20 +470,15 @@ option_help * createGlobalOptions(IOR_param_t * params){ {'N', NULL, "numTasks -- number of tasks that are participating in the test (overrides MPI)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->numTasks}, {'o', NULL, "testFile -- full name for test", OPTION_OPTIONAL_ARGUMENT, 's', & params->testFileName}, {'O', NULL, "string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32)", OPTION_OPTIONAL_ARGUMENT, 'p', & decodeDirectiveWrapper}, - {'p', NULL, "preallocate -- preallocate file size", OPTION_FLAG, 'd', & params->preallocate}, - {'P', NULL, "useSharedFilePointer -- use shared file pointer [not working]", OPTION_FLAG, 'd', & params->useSharedFilePointer}, {'q', NULL, "quitOnError -- during file error-checking, abort on error", OPTION_FLAG, 'd', & params->quitOnError}, {'Q', NULL, "taskPerNodeOffset for read tests use with -C & -Z options (-C constant N, -Z at least N)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->taskPerNodeOffset}, {'r', NULL, "readFile -- read existing file", OPTION_FLAG, 'd', & params->readFile}, {'R', NULL, "checkRead -- verify that the output of read matches the expected signature (used with -G)", OPTION_FLAG, 'd', & params->checkRead}, {'s', NULL, "segmentCount -- number of segments", OPTION_OPTIONAL_ARGUMENT, 'd', & params->segmentCount}, - {'S', NULL, "useStridedDatatype -- put strided access into datatype [not working]", OPTION_FLAG, 'd', & params->useStridedDatatype}, {'t', NULL, "transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'l', & params->transferSize}, {'T', NULL, "maxTimeDuration -- max time in minutes executing repeated test; it aborts only between iterations and not within a test!", OPTION_OPTIONAL_ARGUMENT, 'd', & params->maxTimeDuration}, {'u', NULL, "uniqueDir -- use unique directory name for each file-per-process", OPTION_FLAG, 'd', & params->uniqueDir}, - {'U', NULL, "hintsFileName -- full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & params->hintsFileName}, {'v', NULL, "verbose -- output information (repeating flag increases level)", OPTION_FLAG, 'd', & params->verbose}, - {'V', NULL, "useFileView -- use MPI_File_set_view", OPTION_FLAG, 'd', & params->useFileView}, {'w', NULL, "writeFile -- write file", OPTION_FLAG, 'd', & params->writeFile}, {'W', NULL, "checkWrite -- check read after write", OPTION_FLAG, 'd', & params->checkWrite}, {'x', NULL, "singleXferAttempt -- do not retry transfer if incomplete", OPTION_FLAG, 'd', & params->singleXferAttempt}, From aa9e2ad8150eb3a72a69d6486568ea67b923fa96 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 18:30:26 +0100 Subject: [PATCH 02/11] MDTest updated for AIORI changes. --- src/mdtest.c | 63 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/src/mdtest.c b/src/mdtest.c index 6d789f0..4b4dd15 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -166,6 +166,7 @@ static uid_t uid; /* Use the POSIX backend by default */ static const ior_aiori_t *backend; +static void * backend_options; static IOR_param_t param; @@ -276,7 +277,7 @@ static void phase_end(){ if(! backend->sync){ FAIL("Error, backend does not provide the sync method, but you requested to use sync.\n"); } - backend->sync(& param); + backend->sync(backend_options); } if (barriers) { @@ -318,11 +319,11 @@ static void create_remove_dirs (const char *path, bool create, uint64_t itemNum) VERBOSE(3,5,"create_remove_items_helper (dirs %s): curr_item is '%s'", operation, curr_item); if (create) { - if (backend->mkdir(curr_item, DIRMODE, ¶m) == -1) { + if (backend->mkdir(curr_item, DIRMODE, backend_options) == -1) { FAIL("unable to create directory %s", curr_item); } } else { - if (backend->rmdir(curr_item, ¶m) == -1) { + if (backend->rmdir(curr_item, backend_options) == -1) { FAIL("unable to remove directory %s", curr_item); } } @@ -339,7 +340,7 @@ static void remove_file (const char *path, uint64_t itemNum) { sprintf(curr_item, "%s/file.%s"LLU"", path, rm_name, itemNum); VERBOSE(3,5,"create_remove_items_helper (non-dirs remove): curr_item is '%s'", curr_item); if (!(shared_file && rank != 0)) { - backend->delete (curr_item, ¶m); + backend->delete (curr_item, backend_options); } } @@ -367,7 +368,7 @@ static void create_file (const char *path, uint64_t itemNum) { } else if (collective_creates) { VERBOSE(3,5,"create_remove_items_helper (collective): open..." ); - aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); + aiori_fh = backend->open (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) FAIL("unable to open file %s", curr_item); @@ -378,7 +379,7 @@ static void create_file (const char *path, uint64_t itemNum) { param.filePerProc = !shared_file; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); - aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m.backend_options); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) FAIL("unable to create file %s", curr_item); } @@ -392,13 +393,13 @@ static void create_file (const char *path, uint64_t itemNum) { */ param.offset = 0; param.fsyncPerWrite = sync_file; - if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, ¶m)) { + if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { FAIL("unable to write file %s", curr_item); } } VERBOSE(3,5,"create_remove_items_helper: close..." ); - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } /* helper for creating/removing items */ @@ -445,15 +446,15 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 void *aiori_fh; //create files - aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, ¶m); + aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); if (NULL == aiori_fh) { FAIL("unable to create file %s", curr_item); } - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } else if (!(shared_file && rank != 0)) { //remove files - backend->delete (curr_item, ¶m); + backend->delete (curr_item, backend_options); } if(CHECK_STONE_WALL(progress)){ progress->items_done = i + 1; @@ -610,7 +611,7 @@ void mdtest_stat(const int random, const int dirs, const long dir_iter, const ch /* below temp used to be hiername */ VERBOSE(3,5,"mdtest_stat %4s: %s", (dirs ? "dir" : "file"), item); - if (-1 == backend->stat (item, &buf, ¶m)) { + if (-1 == backend->stat (item, &buf, backend_options)) { FAIL("unable to stat %s %s", dirs ? "directory" : "file", item); } } @@ -707,7 +708,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { VERBOSE(3,5,"mdtest_read file: %s", item); /* open file for reading */ - aiori_fh = backend->open (item, O_RDONLY, ¶m); + aiori_fh = backend->open (item, O_RDONLY, backend_options); if (NULL == aiori_fh) { FAIL("unable to open file %s", item); } @@ -715,7 +716,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* read file */ if (read_bytes > 0) { read_buffer[0] = 42; /* use a random value to ensure that the read_buffer is now different from the expected buffer and read isn't sometimes NOOP */ - if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, ¶m)) { + if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, backend_options)) { FAIL("unable to read file %s", item); } if(verify_read){ @@ -727,7 +728,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { } /* close file */ - backend->close (aiori_fh, ¶m); + backend->close (aiori_fh, backend_options); } } @@ -1482,7 +1483,7 @@ void show_file_system_size(char *file_system) { VERBOSE(1,-1,"Entering show_file_system_size on %s", file_system ); - ret = backend->statfs (file_system, &stat_buf, ¶m); + ret = backend->statfs (file_system, &stat_buf, backend_options); if (0 != ret) { FAIL("unable to stat file system %s", file_system); } @@ -1546,9 +1547,6 @@ void display_freespace(char *testdirpath) strcpy(dirpath, "."); } - if (param.api && strcasecmp(param.api, "DFS") == 0) - return; - VERBOSE(3,5,"Before show_file_system_size, dirpath is '%s'", dirpath ); show_file_system_size(dirpath); VERBOSE(3,5, "After show_file_system_size, dirpath is '%s'\n", dirpath ); @@ -1570,7 +1568,7 @@ void create_remove_directory_tree(int create, if (create) { VERBOSE(2,5,"Making directory '%s'", dir); - if (-1 == backend->mkdir (dir, DIRMODE, ¶m)) { + if (-1 == backend->mkdir (dir, DIRMODE, backend_options)) { fprintf(out_logfile, "error could not create directory '%s'\n", dir); } #ifdef HAVE_LUSTRE_LUSTREAPI @@ -1588,7 +1586,7 @@ void create_remove_directory_tree(int create, if (!create) { VERBOSE(2,5,"Remove directory '%s'", dir); - if (-1 == backend->rmdir(dir, ¶m)) { + if (-1 == backend->rmdir(dir, backend_options)) { FAIL("Unable to remove directory %s", dir); } } @@ -1604,7 +1602,7 @@ void create_remove_directory_tree(int create, if (create) { VERBOSE(2,5,"Making directory '%s'", temp_path); - if (-1 == backend->mkdir(temp_path, DIRMODE, ¶m)) { + if (-1 == backend->mkdir(temp_path, DIRMODE, backend_options)) { FAIL("Unable to create directory %s", temp_path); } } @@ -1615,7 +1613,7 @@ void create_remove_directory_tree(int create, if (!create) { VERBOSE(2,5,"Remove directory '%s'", temp_path); - if (-1 == backend->rmdir(temp_path, ¶m)) { + if (-1 == backend->rmdir(temp_path, backend_options)) { FAIL("Unable to remove directory %s", temp_path); } } @@ -1644,8 +1642,8 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t prep_testdir(j, dir_iter); VERBOSE(2,5,"main (for j loop): making testdir, '%s'", testdir ); - if ((rank < path_count) && backend->access(testdir, F_OK, ¶m) != 0) { - if (backend->mkdir(testdir, DIRMODE, ¶m) != 0) { + if ((rank < path_count) && backend->access(testdir, F_OK, backend_options) != 0) { + if (backend->mkdir(testdir, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory %s", testdir); } #ifdef HAVE_LUSTRE_LUSTREAPI @@ -1825,9 +1823,9 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t for (int dir_iter = 0; dir_iter < directory_loops; dir_iter ++){ prep_testdir(j, dir_iter); - if ((rank < path_count) && backend->access(testdir, F_OK, ¶m) == 0) { + if ((rank < path_count) && backend->access(testdir, F_OK, backend_options) == 0) { //if (( rank == 0 ) && access(testdir, F_OK) == 0) { - if (backend->rmdir(testdir, ¶m) == -1) { + if (backend->rmdir(testdir, backend_options) == -1) { FAIL("unable to remove directory %s", testdir); } } @@ -1956,6 +1954,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * options_all_t * global_options = airoi_create_all_module_options(options); option_parse(argc, argv, global_options); updateParsedOptions(& param, global_options); + backend_options = param.backend_options; free(global_options->modules); free(global_options); @@ -1964,8 +1963,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * MPI_Comm_rank(testComm, &rank); MPI_Comm_size(testComm, &size); - if (backend->initialize) - backend->initialize(param.backend_options); + if (backend->initialize){ + backend->initialize(backend_options); + } pid = getpid(); uid = getuid(); @@ -2256,8 +2256,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * free(rand_array); } - if (backend->finalize) - backend->finalize(param.backend_options); + if (backend->finalize){ + backend->finalize(backend_options); + } return summary_table; } From 930ccdc68d453bf7027c26f3395f3d6f68c1d6d3 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 19:01:20 +0100 Subject: [PATCH 03/11] Updated HDF5 to new module specification. --- src/aiori-HDF5.c | 202 +++++++++++++++++++++++++------------------- src/aiori-MPIIO.c | 2 +- src/ior-output.c | 2 - src/ior.c | 31 +------ src/ior.h | 5 -- src/parse_options.c | 9 -- 6 files changed, 120 insertions(+), 131 deletions(-) diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index ab329db..85a6e19 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,22 +81,29 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, IOR_param_t *); -static void SetupDataSet(void *, IOR_param_t *); -static void *HDF5_Create(char *, IOR_param_t *); -static void *HDF5_Open(char *, IOR_param_t *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); +static void SetupDataSet(void *, void *); +static void *HDF5_Create(char *, int flags, void *); +static void *HDF5_Open(char *, int flags, void *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void HDF5_Close(void *, IOR_param_t *); -static void HDF5_Delete(char *, IOR_param_t *); + IOR_offset_t, void *); +static void HDF5_Close(void *, void *); +static void HDF5_Delete(char *, void *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, IOR_param_t *); -static IOR_offset_t HDF5_GetFileSize(IOR_param_t *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, IOR_param_t *); +static void HDF5_Fsync(void *, void *); +static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, void *); +static void HDF5_init_xfer_options(IOR_param_t * params); +static int HDF5_check_params(void * options); /************************** O P T I O N S *****************************/ typedef struct{ int collective_md; + char * hintsFileName; /* full name for hints file */ + int showHints; /* show hints */ + int individualDataSets; /* datasets not shared by all procs */ + int noFill; /* no fill in file creation */ + IOR_offset_t setAlignment; /* alignment in bytes */ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ @@ -106,14 +113,21 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu if (init_values != NULL){ memcpy(o, init_values, sizeof(HDF5_options_t)); }else{ + memset(o, 0, sizeof(HDF5_options_t)); /* initialize the options properly */ o->collective_md = 0; + o->setAlignment = 1; } *init_backend_options = o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, + {0, "hdf5.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, + {0, "hdf5.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, + {0, "hdf5.individualDataSets", "Datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & o->individualDataSets}, + {0, "hdf5.setAlignment", "HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', & o->setAlignment}, + {0, "hdf5.noFill", "No fill in HDF5 file creation", OPTION_FLAG, 'd', & o->noFill}, LAST_OPTION }; option_help * help = malloc(sizeof(h)); @@ -133,6 +147,7 @@ ior_aiori_t hdf5_aiori = { .close = HDF5_Close, .delete = HDF5_Delete, .get_version = HDF5_GetVersion, + .init_xfer_options = HDF5_init_xfer_options, .fsync = HDF5_Fsync, .get_file_size = HDF5_GetFileSize, .statfs = aiori_posix_statfs, @@ -140,7 +155,8 @@ ior_aiori_t hdf5_aiori = { .rmdir = aiori_posix_rmdir, .access = HDF5_Access, .stat = aiori_posix_stat, - .get_options = HDF5_options + .get_options = HDF5_options, + .check_params = HDF5_check_params }; static hid_t xferPropList; /* xfer property list */ @@ -151,20 +167,47 @@ hid_t memDataSpace; /* memory data space id */ int newlyOpenedFile; /* newly opened file */ /***************************** F U N C T I O N S ******************************/ +static IOR_param_t * ior_param = NULL; + +static void HDF5_init_xfer_options(IOR_param_t * params){ + ior_param = params; +} + +static int HDF5_check_params(void * options){ + HDF5_options_t *o = (HDF5_options_t*) options; + if (o->setAlignment < 0) + ERR("alignment must be non-negative integer"); + if (o->individualDataSets) + ERR("individual data sets not implemented"); + if (o->noFill) { + /* check if hdf5 available */ +#if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) + /* no-fill option not available until hdf5-1.6.x */ +#if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) +#else + ERRF("'no fill' option not available in HDF5"); +#endif +#else + WARN("unable to determine HDF5 version for 'no fill' usage"); +#endif + } + return 0; +} /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, IOR_param_t * param) +static void *HDF5_Create(char *testFileName, int flags, void * param) { - return HDF5_Open(testFileName, param); + return HDF5_Open(testFileName, flags, param); } /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, IOR_param_t * param) +static void *HDF5_Open(char *testFileName, int flags, void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; hsize_t memStart[NUM_DIMS], dataSetDims[NUM_DIMS], @@ -182,36 +225,27 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) /* * HDF5 uses different flags than those for POSIX/MPIIO */ - if (param->open == WRITE) { /* WRITE flags */ - param->openFlags = IOR_TRUNC; - } else { /* READ or check WRITE/READ flags */ - param->openFlags = IOR_RDONLY; - } - /* set IOR file flags to HDF5 flags */ /* -- file open flags -- */ - if (param->openFlags & IOR_RDONLY) { + if (flags & IOR_RDONLY) { fd_mode |= H5F_ACC_RDONLY; } - if (param->openFlags & IOR_WRONLY) { - fprintf(stdout, "File write only not implemented in HDF5\n"); - } - if (param->openFlags & IOR_RDWR) { + if (flags & IOR_WRONLY || flags & IOR_RDWR) { fd_mode |= H5F_ACC_RDWR; } - if (param->openFlags & IOR_APPEND) { + if (flags & IOR_APPEND) { fprintf(stdout, "File append not implemented in HDF5\n"); } - if (param->openFlags & IOR_CREAT) { + if (flags & IOR_CREAT) { fd_mode |= H5F_ACC_CREAT; } - if (param->openFlags & IOR_EXCL) { + if (flags & IOR_EXCL) { fd_mode |= H5F_ACC_EXCL; } - if (param->openFlags & IOR_TRUNC) { + if (flags & IOR_TRUNC) { fd_mode |= H5F_ACC_TRUNC; } - if (param->openFlags & IOR_DIRECT) { + if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in HDF5\n"); } @@ -231,13 +265,13 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * someday HDF5 implementation will allow subsets of MPI_COMM_WORLD */ /* store MPI communicator info for the file access property list */ - if (param->filePerProc) { + if (ior_param->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; } - SetHints(&mpiHints, param->hintsFileName); + SetHints(&mpiHints, o->hintsFileName); /* * note that with MP_HINTS_FILTERED=no, all key/value pairs will * be in the info object. The info object that is attached to @@ -245,7 +279,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * deemed valid by the implementation. */ /* show hints passed to file */ - if (rank == 0 && param->showHints) { + if (rank == 0 && o->showHints) { fprintf(stdout, "\nhints passed to access property list {\n"); ShowHints(&mpiHints); fprintf(stdout, "}\n"); @@ -254,12 +288,11 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) "cannot set file access property list"); /* set alignment */ - HDF5_CHECK(H5Pset_alignment(accessPropList, param->setAlignment, - param->setAlignment), + HDF5_CHECK(H5Pset_alignment(accessPropList, o->setAlignment, o->setAlignment), "cannot set alignment"); #ifdef HAVE_H5PSET_ALL_COLL_METADATA_OPS - HDF5_options_t *o = (HDF5_options_t*) param->backend_options; + if (o->collective_md) { /* more scalable metadata */ @@ -271,10 +304,9 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) #endif /* open file */ - if(! param->dryRun){ - if (param->open == WRITE) { /* WRITE */ - *fd = H5Fcreate(testFileName, fd_mode, - createPropList, accessPropList); + if(! ior_param->dryRun){ + if (ior_param->open == WRITE) { /* WRITE */ + *fd = H5Fcreate(testFileName, H5F_ACC_TRUNC, createPropList, accessPropList); HDF5_CHECK(*fd, "cannot create file"); } else { /* READ or CHECK */ *fd = H5Fopen(testFileName, fd_mode, accessPropList); @@ -283,9 +315,8 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) } /* show hints actually attached to file handle */ - if (param->showHints || (1) /* WEL - this needs fixing */ ) { - if (rank == 0 - && (param->showHints) /* WEL - this needs fixing */ ) { + if (o->showHints || (1) /* WEL - this needs fixing */ ) { + if (rank == 0 && (o->showHints) /* WEL - this needs fixing */ ) { WARN("showHints not working for HDF5"); } } else { @@ -334,7 +365,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) HDF5_CHECK(xferPropList, "cannot create transfer property list"); /* set data transfer mode */ - if (param->collective) { + if (ior_param->collective) { HDF5_CHECK(H5Pset_dxpl_mpio(xferPropList, H5FD_MPIO_COLLECTIVE), "cannot set collective data transfer mode"); } else { @@ -346,9 +377,9 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) /* set up memory data space for transfer */ memStart[0] = (hsize_t) 0; memCount[0] = (hsize_t) 1; - memStride[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - memBlock[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - memDataSpaceDims[0] = (hsize_t) param->transferSize; + memStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + memBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + memDataSpaceDims[0] = (hsize_t) ior_param->transferSize; memDataSpace = H5Screate_simple(NUM_DIMS, memDataSpaceDims, NULL); HDF5_CHECK(memDataSpace, "cannot create simple memory data space"); @@ -358,18 +389,18 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) memBlock), "cannot create hyperslab"); /* set up parameters for fpp or different dataset count */ - if (param->filePerProc) { + if (ior_param->filePerProc) { tasksPerDataSet = 1; } else { - if (param->individualDataSets) { + if (o->individualDataSets) { /* each task in segment has single data set */ tasksPerDataSet = 1; } else { /* share single data set across all tasks in segment */ - tasksPerDataSet = param->numTasks; + tasksPerDataSet = ior_param->numTasks; } } - dataSetDims[0] = (hsize_t) ((param->blockSize / sizeof(IOR_size_t)) + dataSetDims[0] = (hsize_t) ((ior_param->blockSize / sizeof(IOR_size_t)) * tasksPerDataSet); /* create a simple data space containing information on size @@ -386,7 +417,7 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, IOR_param_t * param) + IOR_offset_t length, void * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -405,17 +436,16 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, } /* determine by offset if need to start new data set */ - if (param->filePerProc == TRUE) { + if (ior_param->filePerProc == TRUE) { segmentPosition = (IOR_offset_t) 0; - segmentSize = param->blockSize; + segmentSize = ior_param->blockSize; } else { segmentPosition = - (IOR_offset_t) ((rank + rankOffset) % param->numTasks) - * param->blockSize; - segmentSize = - (IOR_offset_t) (param->numTasks) * param->blockSize; + (IOR_offset_t) ((rank + rankOffset) % ior_param->numTasks) + * ior_param->blockSize; + segmentSize = (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; } - if ((IOR_offset_t) ((param->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((ior_param->offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -427,7 +457,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, } } - if(param->dryRun) + if(ior_param->dryRun) return length; /* create new data set */ @@ -441,7 +471,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, SetupDataSet(fd, param); } - SeekOffset(fd, param->offset, param); + SeekOffset(fd, ior_param->offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; @@ -465,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, IOR_param_t * param) +static void HDF5_Fsync(void *fd, void * param) { ; } @@ -473,11 +503,11 @@ static void HDF5_Fsync(void *fd, IOR_param_t * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, IOR_param_t * param) +static void HDF5_Close(void *fd, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return; - if (param->fd_fppReadCheck == NULL) { + //if (ior_param->fd_fppReadCheck == NULL) { HDF5_CHECK(H5Dclose(dataSet), "cannot close data set"); HDF5_CHECK(H5Sclose(dataSpace), "cannot close data space"); HDF5_CHECK(H5Sclose(fileDataSpace), @@ -486,7 +516,7 @@ static void HDF5_Close(void *fd, IOR_param_t * param) "cannot close memory data space"); HDF5_CHECK(H5Pclose(xferPropList), " cannot close transfer property list"); - } + //} HDF5_CHECK(H5Fclose(*(hid_t *) fd), "cannot close file"); free(fd); } @@ -494,9 +524,9 @@ static void HDF5_Close(void *fd, IOR_param_t * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, IOR_param_t * param) +static void HDF5_Delete(char *testFileName, void * param) { - if(param->dryRun) + if(ior_param->dryRun) return MPIIO_Delete(testFileName, param); return; @@ -528,23 +558,24 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - IOR_param_t * param) + void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; hsize_t hsStride[NUM_DIMS], hsCount[NUM_DIMS], hsBlock[NUM_DIMS]; hsize_t hsStart[NUM_DIMS]; - if (param->filePerProc == TRUE) { - segmentSize = (IOR_offset_t) param->blockSize; + if (ior_param->filePerProc == TRUE) { + segmentSize = (IOR_offset_t) ior_param->blockSize; } else { segmentSize = - (IOR_offset_t) (param->numTasks) * param->blockSize; + (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; } /* create a hyperslab representing the file data space */ - if (param->individualDataSets) { + if (o->individualDataSets) { /* start at zero offset if not */ - hsStart[0] = (hsize_t) ((offset % param->blockSize) + hsStart[0] = (hsize_t) ((offset % ior_param->blockSize) / sizeof(IOR_size_t)); } else { /* start at a unique offset if shared */ @@ -552,8 +583,8 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, (hsize_t) ((offset % segmentSize) / sizeof(IOR_size_t)); } hsCount[0] = (hsize_t) 1; - hsStride[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); - hsBlock[0] = (hsize_t) (param->transferSize / sizeof(IOR_size_t)); + hsStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + hsBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); /* retrieve data space from data set for hyperslab */ fileDataSpace = H5Dget_space(dataSet); @@ -567,8 +598,9 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, IOR_param_t * param) +static void SetupDataSet(void *fd, void * param) { + HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; hid_t dataSetPropList; int dataSetID; @@ -582,8 +614,8 @@ static void SetupDataSet(void *fd, IOR_param_t * param) dataSetSuffix = 0; /* may want to use individual access to each data set someday */ - if (param->individualDataSets) { - dataSetID = (rank + rankOffset) % param->numTasks; + if (o->individualDataSets) { + dataSetID = (rank + rankOffset) % ior_param->numTasks; } else { dataSetID = 0; } @@ -591,14 +623,14 @@ static void SetupDataSet(void *fd, IOR_param_t * param) sprintf(dataSetName, "%s-%04d.%04d", "Dataset", dataSetID, dataSetSuffix++); - if (param->open == WRITE) { /* WRITE */ + if (ior_param->open == WRITE) { /* WRITE */ /* create data set */ dataSetPropList = H5Pcreate(H5P_DATASET_CREATE); /* check if hdf5 available */ #if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) /* no-fill option not available until hdf5-1.6.x */ #if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) - if (param->noFill == TRUE) { + if (o->noFill == TRUE) { if (rank == 0 && verbose >= VERBOSE_1) { fprintf(stdout, "\nusing 'no fill' option\n"); } @@ -629,9 +661,9 @@ static void SetupDataSet(void *fd, IOR_param_t * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) { - if(test->dryRun) + if(ior_param->dryRun) return 0; return(MPIIO_GetFileSize(test, testComm, testFileName)); } @@ -639,9 +671,9 @@ HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, IOR_param_t *param) +static int HDF5_Access(const char *path, int mode, void *param) { - if(param->dryRun) + if(ior_param->dryRun) return 0; return(MPIIO_Access(path, mode, param)); } diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 443230b..5c8a012 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -52,7 +52,7 @@ typedef struct { int preallocate; /* preallocate file size */ int useSharedFilePointer; /* use shared file pointer */ int useStridedDatatype; /* put strided access into datatype */ - char * hintsFileName; /* full name for hints file */ + char * hintsFileName; /* full name for hints file */ } mpiio_options_t; static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ diff --git a/src/ior-output.c b/src/ior-output.c index 3bb8fd7..fe5039d 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -355,7 +355,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("fsyncperwrite", test->fsyncPerWrite); PrintKeyValInt("useExistingTestFile", test->useExistingTestFile); PrintKeyValInt("uniqueDir", test->uniqueDir); - PrintKeyValInt("individualDataSets", test->individualDataSets); PrintKeyValInt("singleXferAttempt", test->singleXferAttempt); PrintKeyValInt("readFile", test->readFile); PrintKeyValInt("writeFile", test->writeFile); @@ -366,7 +365,6 @@ void ShowTestStart(IOR_param_t *test) PrintKeyValInt("randomOffset", test->randomOffset); PrintKeyValInt("checkWrite", test->checkWrite); PrintKeyValInt("checkRead", test->checkRead); - PrintKeyValInt("setAlignment", test->setAlignment); PrintKeyValInt("storeFileOffset", test->storeFileOffset); PrintKeyValInt("keepFile", test->keepFile); PrintKeyValInt("keepFileWithError", test->keepFileWithError); diff --git a/src/ior.c b/src/ior.c index 206a9f4..33c21ba 100755 --- a/src/ior.c +++ b/src/ior.c @@ -68,7 +68,7 @@ static void test_initialize(IOR_test_t * test){ backend->initialize(test->params.backend_options); } if(backend->init_xfer_options){ - backend->init_xfer_options(test); + backend->init_xfer_options(& test->params); } } @@ -214,7 +214,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->randomSeed = -1; p->incompressibleSeed = 573; p->testComm = mpi_comm_world; - p->setAlignment = 1; p->lustre_start_ost = -1; hdfs_user = getenv("USER"); @@ -1343,7 +1342,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = WRITE; timer[0] = GetTimeStamp(); - fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT, params->backend_options); + fd = backend->create(testFileName, IOR_WRONLY | IOR_CREAT | IOR_TRUNC, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1592,8 +1591,6 @@ static void ValidateTests(IOR_param_t * test) ERR("block size must be non-negative integer"); if ((test->transferSize % sizeof(IOR_size_t)) != 0) ERR("transfer size must be a multiple of access size"); - if (test->setAlignment < 0) - ERR("alignment must be non-negative integer"); if (test->transferSize < 0) ERR("transfer size must be non-negative integer"); if (test->transferSize == 0) { @@ -1647,32 +1644,8 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with HDF5"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->randomOffset) ERR("random offset not available with NCMPI"); - if ((strcasecmp(test->api, "HDF5") != 0) && test->individualDataSets) - WARN_RESET("individual datasets only available in HDF5", - test, &defaults, individualDataSets); - if ((strcasecmp(test->api, "HDF5") == 0) && test->individualDataSets) - WARN_RESET("individual data sets not implemented", - test, &defaults, individualDataSets); if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if (test->noFill) { - if (strcasecmp(test->api, "HDF5") != 0) { - ERR("'no fill' option only available in HDF5"); - } else { - /* check if hdf5 available */ -#if defined (H5_VERS_MAJOR) && defined (H5_VERS_MINOR) - /* no-fill option not available until hdf5-1.6.x */ -#if (H5_VERS_MAJOR > 0 && H5_VERS_MINOR > 5) - ; -#else - ERRF("'no fill' option not available in %s", - test->apiVersion); -#endif -#else - WARN("unable to determine HDF5 version for 'no fill' usage"); -#endif - } - } if (test->useExistingTestFile && test->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); diff --git a/src/ior.h b/src/ior.h index 14d6ddf..52c68a1 100755 --- a/src/ior.h +++ b/src/ior.h @@ -159,11 +159,6 @@ typedef struct MPI_Datatype transferType; /* datatype for transfer */ MPI_Datatype fileType; /* filetype for file view */ - /* HDF5 variables */ - int individualDataSets; /* datasets not shared by all procs */ - int noFill; /* no fill in file creation */ - IOR_offset_t setAlignment; /* alignment in bytes */ - /* HDFS variables */ char * hdfs_user; /* copied from ENV, for now */ const char* hdfs_name_node; diff --git a/src/parse_options.c b/src/parse_options.c index 51a5d24..f976fe8 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -179,16 +179,10 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt params->blockSize = string_to_bytes(value); } else if (strcasecmp(option, "transfersize") == 0) { params->transferSize = string_to_bytes(value); - } else if (strcasecmp(option, "setalignment") == 0) { - params->setAlignment = string_to_bytes(value); } else if (strcasecmp(option, "singlexferattempt") == 0) { params->singleXferAttempt = atoi(value); - } else if (strcasecmp(option, "individualdatasets") == 0) { - params->individualDataSets = atoi(value); } else if (strcasecmp(option, "intraTestBarriers") == 0) { params->intraTestBarriers = atoi(value); - } else if (strcasecmp(option, "nofill") == 0) { - params->noFill = atoi(value); } else if (strcasecmp(option, "verbose") == 0) { params->verbose = atoi(value); } else if (strcasecmp(option, "settimestampsignature") == 0) { @@ -458,15 +452,12 @@ option_help * createGlobalOptions(IOR_param_t * params){ */ {'G', NULL, "setTimeStampSignature -- set value for time stamp signature/random seed", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setTimeStampSignature}, {'i', NULL, "repetitions -- number of repetitions of test", OPTION_OPTIONAL_ARGUMENT, 'd', & params->repetitions}, - {'I', NULL, "individualDataSets -- datasets not shared by all procs [not working]", OPTION_FLAG, 'd', & params->individualDataSets}, {'j', NULL, "outlierThreshold -- warn on outlier N seconds from mean", OPTION_OPTIONAL_ARGUMENT, 'd', & params->outlierThreshold}, - {'J', NULL, "setAlignment -- HDF5 alignment in bytes (e.g.: 8, 4k, 2m, 1g)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->setAlignment}, {'k', NULL, "keepFile -- don't remove the test file(s) on program exit", OPTION_FLAG, 'd', & params->keepFile}, {'K', NULL, "keepFileWithError -- keep error-filled file(s) after data-checking", OPTION_FLAG, 'd', & params->keepFileWithError}, {'l', NULL, "datapacket type-- type of packet that will be created [offset|incompressible|timestamp|o|i|t]", OPTION_OPTIONAL_ARGUMENT, 's', & params->buffer_type}, {'m', NULL, "multiFile -- use number of reps (-i) for multiple file count", OPTION_FLAG, 'd', & params->multiFile}, {'M', NULL, "memoryPerNode -- hog memory on the node (e.g.: 2g, 75%)", OPTION_OPTIONAL_ARGUMENT, 's', & params->memoryPerNodeStr}, - {'n', NULL, "noFill -- no fill in HDF5 file creation", OPTION_FLAG, 'd', & params->noFill}, {'N', NULL, "numTasks -- number of tasks that are participating in the test (overrides MPI)", OPTION_OPTIONAL_ARGUMENT, 'd', & params->numTasks}, {'o', NULL, "testFile -- full name for test", OPTION_OPTIONAL_ARGUMENT, 's', & params->testFileName}, {'O', NULL, "string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32)", OPTION_OPTIONAL_ARGUMENT, 'p', & decodeDirectiveWrapper}, From e91b79cea029282f46b0c9c228d4b60e654375a6 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 30 May 2020 20:09:37 +0100 Subject: [PATCH 04/11] Moved Lustre/GPFS/BeeGFS options into POSIX backend. Needs testing. Additional minor fixes. --- src/aiori-MMAP.c | 1 + src/aiori-POSIX.c | 100 ++++++++++++++++++++++++++++++++------------ src/aiori.h | 1 + src/ior-output.c | 8 ---- src/ior.c | 14 ++----- src/ior.h | 18 +------- src/iordef.h | 4 +- src/mdtest.c | 6 +++ src/parse_options.c | 49 ---------------------- src/utilities.c | 2 +- 10 files changed, 90 insertions(+), 113 deletions(-) diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 0b55557..10c196e 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -86,6 +86,7 @@ static IOR_param_t * ior_param = NULL; static void MMAP_init_xfer_options(IOR_param_t * params){ ior_param = params; + aiori_posix_init_xfer_options(params); } static int MMAP_check_params(void * options){ diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index f7c9cd3..b7b01e4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -72,13 +72,28 @@ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, IOR_offset_t, void *); static void POSIX_Fsync(void *, void *); static void POSIX_Sync(void * ); -static void POSIX_init_xfer_options(IOR_param_t * params); - +static int POSIX_check_params(void * options); /************************** O P T I O N S *****************************/ typedef struct{ /* in case of a change, please update depending MMAP module too */ int direct_io; + + /* Lustre variables */ + int lustre_set_striping; /* flag that we need to set lustre striping */ + int lustre_stripe_count; + int lustre_stripe_size; + int lustre_start_ost; + int lustre_ignore_locks; + + /* gpfs variables */ + int gpfs_hint_access; /* use gpfs "access range" hint */ + int gpfs_release_token; /* immediately release GPFS tokens after + creating or opening a file */ + /* beegfs variables */ + int beegfs_numTargets; /* number storage targets to use */ + int beegfs_chunkSize; /* srtipe pattern for new files */ + } posix_options_t; @@ -88,13 +103,32 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){ if (init_values != NULL){ memcpy(o, init_values, sizeof(posix_options_t)); }else{ + memset(o, 0, sizeof(posix_options_t)); o->direct_io = 0; + o->lustre_start_ost = -1; + o->beegfs_numTargets = -1; + o->beegfs_chunkSize = -1; } *init_backend_options = o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, +#ifdef HAVE_BEEGFS_BEEGFS_H + {0, "posix.beegfs.NumTargets", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_numTargets}, + {0, "posix.beegfs.ChunkSize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->beegfs_chunkSize}, +#endif +#ifdef HAVE_GPFS_FCNTL_H + {0, "posix.gpfs.hintaccess", "", OPTION_FLAG, 'd', & o->gpfs_hint_access}, + {0, "posix.gpfs.releasetoken", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->gpfs_release_token}, + +#endif +#ifdef HAVE_LUSTRE_LUSTRE_USER_H + {0, "posix.lustre.stripecount", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_count}, + {0, "posix.lustre.stripesize", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_stripe_size}, + {0, "posix.lustre.startost", "", OPTION_OPTIONAL_ARGUMENT, 'd', & o->lustre_start_ost}, + {0, "posix.lustre.ignorelocks", "", OPTION_FLAG, 'd', & o->lustre_ignore_locks}, +#endif LAST_OPTION }; option_help * help = malloc(sizeof(h)); @@ -115,7 +149,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, - .init_xfer_options = POSIX_init_xfer_options, + .init_xfer_options = aiori_posix_init_xfer_options, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -126,17 +160,29 @@ ior_aiori_t posix_aiori = { .stat = aiori_posix_stat, .get_options = POSIX_options, .enable_mdtest = true, - .sync = POSIX_Sync + .sync = POSIX_Sync, + .check_params = POSIX_check_params }; /***************************** F U N C T I O N S ******************************/ static IOR_param_t * ior_param = NULL; -static void POSIX_init_xfer_options(IOR_param_t * params){ +void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } +static int POSIX_check_params(void * param){ + posix_options_t * o = (posix_options_t*) param; + if (ior_param->useExistingTestFile && o->lustre_set_striping) + ERR("Lustre stripe options are incompatible with useExistingTestFile"); + if (o->beegfs_chunkSize != -1 && (!ISPOWEROFTWO(o->beegfs_chunkSize) || o->beegfs_chunkSize < (1<<16))) + ERR("beegfsChunkSize must be a power of two and >64k"); + if(o->lustre_stripe_count != -1 || o->lustre_stripe_size != 0) + o->lustre_set_striping = 1; + return 0; +} + #ifdef HAVE_GPFS_FCNTL_H void gpfs_free_all_locks(int fd) { @@ -159,7 +205,7 @@ void gpfs_free_all_locks(int fd) EWARNF("gpfs_fcntl(%d, ...) release all locks hint failed.", fd); } } -void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) +void gpfs_access_start(int fd, IOR_offset_t length, int access) { int rc; struct { @@ -173,7 +219,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) take_locks.access.structLen = sizeof(take_locks.access); take_locks.access.structType = GPFS_ACCESS_RANGE; - take_locks.access.start = param->offset; + take_locks.access.start = ior_param->offset; take_locks.access.length = length; take_locks.access.isWrite = (access == WRITE); @@ -183,7 +229,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, void *param, int access) } } -void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) +void gpfs_access_end(int fd, IOR_offset_t length, int access) { int rc; struct { @@ -198,7 +244,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, void *param, int access) free_locks.free.structLen = sizeof(free_locks.free); free_locks.free.structType = GPFS_FREE_RANGE; - free_locks.free.start = param->offset; + free_locks.free.start = ior_param->offset; free_locks.free.length = length; rc = gpfs_fcntl(fd, &free_locks); @@ -349,12 +395,11 @@ void *POSIX_Create(char *testFileName, int flags, void * param) #ifndef FASYNC #define FASYNC 00020000 /* fcntl, for BSD compatibility */ #endif - - if (param->lustre_set_striping) { + if (o->lustre_set_striping) { /* In the single-shared-file case, task 0 has to creat the file with the Lustre striping options before any other processes open the file */ - if (!param->filePerProc && rank != 0) { + if (!ior_param->filePerProc && rank != 0) { MPI_CHECK(MPI_Barrier(testComm), "barrier error"); fd_oflag |= O_RDWR; *fd = open64(testFileName, fd_oflag, mode); @@ -366,9 +411,9 @@ void *POSIX_Create(char *testFileName, int flags, void * param) /* Setup Lustre IOCTL striping pattern structure */ opts.lmm_magic = LOV_USER_MAGIC; - opts.lmm_stripe_size = param->lustre_stripe_size; - opts.lmm_stripe_offset = param->lustre_start_ost; - opts.lmm_stripe_count = param->lustre_stripe_count; + opts.lmm_stripe_size = o->lustre_stripe_size; + opts.lmm_stripe_offset = o->lustre_start_ost; + opts.lmm_stripe_count = o->lustre_stripe_count; /* File needs to be opened O_EXCL because we cannot set * Lustre striping information on a pre-existing file.*/ @@ -391,7 +436,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); } - if (!param->filePerProc) + if (!ior_param->filePerProc) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); } @@ -401,12 +446,12 @@ void *POSIX_Create(char *testFileName, int flags, void * param) fd_oflag |= O_CREAT | O_RDWR; #ifdef HAVE_BEEGFS_BEEGFS_H - if (beegfs_isOptionSet(param->beegfs_chunkSize) - || beegfs_isOptionSet(param->beegfs_numTargets)) { + if (beegfs_isOptionSet(o->beegfs_chunkSize) + || beegfs_isOptionSet(o->beegfs_numTargets)) { bool result = beegfs_createFilePath(testFileName, mode, - param->beegfs_numTargets, - param->beegfs_chunkSize); + o->beegfs_numTargets, + o->beegfs_chunkSize); if (result) { fd_oflag &= ~O_CREAT; } else { @@ -423,7 +468,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) #ifdef HAVE_LUSTRE_LUSTRE_USER_H } - if (param->lustre_ignore_locks) { + if (o->lustre_ignore_locks) { int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK; if (ioctl(*fd, LL_IOC_SETFLAGS, &lustre_ioctl_flags) == -1) ERRF("ioctl(%d, LL_IOC_SETFLAGS, ...) failed", *fd); @@ -434,7 +479,7 @@ void *POSIX_Create(char *testFileName, int flags, void * param) /* in the single shared file case, immediately release all locks, with * the intent that we can avoid some byte range lock revocation: * everyone will be writing/reading from individual regions */ - if (param->gpfs_release_token ) { + if (o->gpfs_release_token ) { gpfs_free_all_locks(*fd); } #endif @@ -481,7 +526,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) ERRF("open64(\"%s\", %d) failed", testFileName, fd_oflag); #ifdef HAVE_LUSTRE_LUSTRE_USER_H - if (param->lustre_ignore_locks) { + if (o->lustre_ignore_locks) { int lustre_ioctl_flags = LL_FILE_IGNORE_LOCK; if (verbose >= VERBOSE_1) { fprintf(stdout, @@ -493,7 +538,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) #endif /* HAVE_LUSTRE_LUSTRE_USER_H */ #ifdef HAVE_GPFS_FCNTL_H - if(param->gpfs_release_token) { + if(o->gpfs_release_token) { gpfs_free_all_locks(*fd); } #endif @@ -511,6 +556,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, char *ptr = (char *)buffer; long long rc; int fd; + posix_options_t * o = (posix_options_t*) param; if(ior_param->dryRun) return length; @@ -518,8 +564,8 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, fd = *(int *)file; #ifdef HAVE_GPFS_FCNTL_H - if (param->gpfs_hint_access) { - gpfs_access_start(fd, length, param, access); + if (o->gpfs_hint_access) { + gpfs_access_start(fd, length, access); } #endif @@ -578,7 +624,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, xferRetries++; } #ifdef HAVE_GPFS_FCNTL_H - if (param->gpfs_hint_access) { + if (o->gpfs_hint_access) { gpfs_access_end(fd, length, param, access); } #endif diff --git a/src/aiori.h b/src/aiori.h index 4dd2eed..f99c424 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -132,6 +132,7 @@ int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); int aiori_posix_rmdir (const char *path, void * module_options); int aiori_posix_access (const char *path, int mode, void * module_options); int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); +void aiori_posix_init_xfer_options(IOR_param_t * params); void *POSIX_Create(char *testFileName, int flags, void * module_options); int POSIX_Mknod(char *testFileName); diff --git a/src/ior-output.c b/src/ior-output.c index fe5039d..2bffd40 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -444,14 +444,6 @@ void ShowSetup(IOR_param_t *params) if(params->dryRun){ PrintKeyValInt("dryRun", params->dryRun); } - -#ifdef HAVE_LUSTRE_LUSTRE_USER_H - if (params->lustre_set_striping) { - PrintKeyVal("Lustre stripe size", ((params->lustre_stripe_size == 0) ? "Use default" : - HumanReadable(params->lustre_stripe_size, BASE_TWO))); - PrintKeyValInt("Lustre stripe count", params->lustre_stripe_count); - } -#endif /* HAVE_LUSTRE_LUSTRE_USER_H */ if (params->deadlineForStonewalling > 0) { PrintKeyValInt("stonewallingTime", params->deadlineForStonewalling); PrintKeyValInt("stoneWallingWearOut", params->stoneWallingWearOut ); diff --git a/src/ior.c b/src/ior.c index 33c21ba..59fc26b 100755 --- a/src/ior.c +++ b/src/ior.c @@ -214,7 +214,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->randomSeed = -1; p->incompressibleSeed = 573; p->testComm = mpi_comm_world; - p->lustre_start_ost = -1; hdfs_user = getenv("USER"); if (!hdfs_user) @@ -228,9 +227,6 @@ void init_IOR_Param_t(IOR_param_t * p) p->URI = NULL; p->part_number = 0; - - p->beegfs_numTargets = -1; - p->beegfs_chunkSize = -1; } static void @@ -1646,15 +1642,13 @@ static void ValidateTests(IOR_param_t * test) ERR("random offset not available with NCMPI"); if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if (test->useExistingTestFile && test->lustre_set_striping) - ERR("Lustre stripe options are incompatible with useExistingTestFile"); + if(test->backend->init_xfer_options){ + test->backend->init_xfer_options(test); + } /* allow the backend to validate the options */ if(test->backend->check_params){ - if(test->backend->init_xfer_options){ - test->backend->init_xfer_options(test); - } - int check = test->backend->check_params(test); + int check = test->backend->check_params(test->backend_options); if (check){ ERR("The backend returned that the test parameters are invalid."); } diff --git a/src/ior.h b/src/ior.h index 52c68a1..f09d617 100755 --- a/src/ior.h +++ b/src/ior.h @@ -36,8 +36,9 @@ typedef void *rados_ioctx_t; #endif #include "option.h" - #include "iordef.h" + +#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) /******************** DATA Packet Type ***************************************/ /* Holds the types of data packets: generic, offset, timestamp, incompressible */ @@ -178,21 +179,6 @@ typedef struct /* NCMPI variables */ int var_id; /* variable id handle for data set */ - /* Lustre variables */ - int lustre_stripe_count; - int lustre_stripe_size; - int lustre_start_ost; - int lustre_set_striping; /* flag that we need to set lustre striping */ - int lustre_ignore_locks; - - /* gpfs variables */ - int gpfs_hint_access; /* use gpfs "access range" hint */ - int gpfs_release_token; /* immediately release GPFS tokens after - creating or opening a file */ - /* beegfs variables */ - int beegfs_numTargets; /* number storage targets to use */ - int beegfs_chunkSize; /* srtipe pattern for new files */ - int id; /* test's unique ID */ int intraTestBarriers; /* barriers between open/op and op/close */ } IOR_param_t; diff --git a/src/iordef.h b/src/iordef.h index 78cf1d3..4c46b29 100755 --- a/src/iordef.h +++ b/src/iordef.h @@ -181,13 +181,13 @@ typedef long long int IOR_size_t; /* display error message and terminate execution */ -#define ERR(MSG) do { \ +#define ERR_ERRNO(MSG) do { \ ERRF("%s", MSG); \ } while (0) /* display a simple error message (i.e. errno is not set) and terminate execution */ -#define ERR_SIMPLE(MSG) do { \ +#define ERR(MSG) do { \ fprintf(stdout, "ior ERROR: %s, (%s:%d)\n", \ MSG, __FILE__, __LINE__); \ fflush(stdout); \ diff --git a/src/mdtest.c b/src/mdtest.c index 4b4dd15..bdd70c9 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -1966,6 +1966,12 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * if (backend->initialize){ backend->initialize(backend_options); } + if(backend->init_xfer_options){ + backend->init_xfer_options(& param); + } + if(backend->check_params){ + backend->check_params(backend_options); + } pid = getpid(); uid = getuid(); diff --git a/src/parse_options.c b/src/parse_options.c index f976fe8..97e10dc 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -32,8 +32,6 @@ #include "option.h" #include "aiori.h" -#define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) - IOR_param_t initialTestParams; option_help * createGlobalOptions(IOR_param_t * params); @@ -205,53 +203,6 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt } else if (strcasecmp(option, "memoryPerNode") == 0) { params->memoryPerNode = NodeMemoryStringToBytes(value); params->memoryPerTask = 0; - } else if (strcasecmp(option, "lustrestripecount") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_stripe_count = atoi(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustrestripesize") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_stripe_size = string_to_bytes(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustrestartost") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_start_ost = atoi(value); - params->lustre_set_striping = 1; - } else if (strcasecmp(option, "lustreignorelocks") == 0) { -#ifndef HAVE_LUSTRE_LUSTRE_USER_H - ERR("ior was not compiled with Lustre support"); -#endif - params->lustre_ignore_locks = atoi(value); - } else if (strcasecmp(option, "gpfshintaccess") == 0) { -#ifndef HAVE_GPFS_FCNTL_H - ERR("ior was not compiled with GPFS hint support"); -#endif - params->gpfs_hint_access = atoi(value); - } else if (strcasecmp(option, "gpfsreleasetoken") == 0) { -#ifndef HAVE_GPFS_FCNTL_H - ERR("ior was not compiled with GPFS hint support"); -#endif - params->gpfs_release_token = atoi(value); - } else if (strcasecmp(option, "beegfsNumTargets") == 0) { -#ifndef HAVE_BEEGFS_BEEGFS_H - ERR("ior was not compiled with BeeGFS support"); -#endif - params->beegfs_numTargets = atoi(value); - if (params->beegfs_numTargets < 1) - ERR("beegfsNumTargets must be >= 1"); - } else if (strcasecmp(option, "beegfsChunkSize") == 0) { - #ifndef HAVE_BEEGFS_BEEGFS_H - ERR("ior was not compiled with BeeGFS support"); - #endif - params->beegfs_chunkSize = string_to_bytes(value); - if (!ISPOWEROFTWO(params->beegfs_chunkSize) || params->beegfs_chunkSize < (1<<16)) - ERR("beegfsChunkSize must be a power of two and >64k"); } else if (strcasecmp(option, "summaryalways") == 0) { params->summary_every_test = atoi(value); } else { diff --git a/src/utilities.c b/src/utilities.c index bcb1e03..1f83c83 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -146,7 +146,7 @@ void updateParsedOptions(IOR_param_t * options, options_all_t * global_options){ } const ior_aiori_t * backend = aiori_select(options->api); if (backend == NULL) - ERR_SIMPLE("unrecognized I/O API"); + ERR("Unrecognized I/O API"); options->backend = backend; /* copy the actual module options into the test */ From 294b8891e69b88c62e431d9d5600bfb0571dc58e Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 11:50:15 +0100 Subject: [PATCH 05/11] Created dummy option type to provide type safety. Fixed various call issues for options. --- src/aiori-DUMMY.c | 40 +++++++-------- src/aiori-HDF5.c | 48 +++++++++--------- src/aiori-MMAP.c | 30 +++++------ src/aiori-MPIIO.c | 125 ++++++++++++++++++++++++---------------------- src/aiori-POSIX.c | 30 +++++------ src/aiori.c | 10 ++-- src/aiori.h | 68 +++++++++++++------------ src/ior.c | 41 ++++++++------- src/ior.h | 6 +-- src/mdtest.c | 4 +- src/option.h | 4 +- 11 files changed, 205 insertions(+), 201 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index c58a128..766a2c0 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -25,7 +25,7 @@ typedef struct { static char * current = (char*) 1; -static option_help * DUMMY_options(void ** init_backend_options, void * init_values){ +static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ dummy_options_t * o = malloc(sizeof(dummy_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(dummy_options_t)); @@ -33,7 +33,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val memset(o, 0, sizeof(dummy_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, @@ -48,7 +48,7 @@ static option_help * DUMMY_options(void ** init_backend_options, void * init_val static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, void * param) +static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -56,7 +56,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) if(verbose > 4){ fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_creates){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = { o->delay_creates / 1000 / 1000, 1000l * (o->delay_creates % 1000000)}; @@ -66,7 +66,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param) return current++; } -static void *DUMMY_Open(char *testFileName, int flags, void * param) +static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, void * param) return current++; } -static void DUMMY_Fsync(void *fd, void * param) +static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -85,18 +85,18 @@ static void DUMMY_Fsync(void *fd, void * param) } -static void DUMMY_Sync(void * param) +static void DUMMY_Sync(airori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, void * param) +static void DUMMY_Close(void *fd, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, void * param) +static void DUMMY_Delete(char *testFileName, airori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -108,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -116,11 +116,11 @@ static IOR_offset_t DUMMY_GetFileSize(void * test, MPI_Comm testComm, char *test return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, void * param){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, airori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } - dummy_options_t * o = (dummy_options_t*) param; + dummy_options_t * o = (dummy_options_t*) options; if (o->delay_xfer){ if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ struct timespec wait = {o->delay_xfer / 1000 / 1000, 1000l * (o->delay_xfer % 1000000)}; @@ -130,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * param){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mod_opt_t * options){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -140,32 +140,32 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, void * pa return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, void * param){ +static int DUMMY_mkdir (const char *path, mode_t mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_rmdir (const char *path, void * param){ +static int DUMMY_rmdir (const char *path, airori_mod_opt_t * options){ return 0; } -static int DUMMY_access (const char *path, int mode, void * param){ +static int DUMMY_access (const char *path, int mode, airori_mod_opt_t * options){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, void * param){ +static int DUMMY_stat (const char *path, struct stat *buf, airori_mod_opt_t * options){ return 0; } -static int DUMMY_check_params(void * test){ +static int DUMMY_check_params(airori_mod_opt_t * options){ return 0; } -static void DUMMY_init(void * options){ +static void DUMMY_init(airori_mod_opt_t * options){ WARN("DUMMY initialized"); count_init++; } -static void DUMMY_final(void * options){ +static void DUMMY_final(airori_mod_opt_t * options){ WARN("DUMMY finalized"); if(count_init <= 0){ ERR("DUMMY invalid finalization\n"); diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 85a6e19..e66e5d4 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,20 +81,20 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); -static void SetupDataSet(void *, void *); -static void *HDF5_Create(char *, int flags, void *); -static void *HDF5_Open(char *, int flags, void *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *); +static void SetupDataSet(void *, airori_mod_opt_t *); +static void *HDF5_Create(char *, int flags, airori_mod_opt_t *); +static void *HDF5_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void HDF5_Close(void *, void *); -static void HDF5_Delete(char *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void HDF5_Close(void *, airori_mod_opt_t *); +static void HDF5_Delete(char *, airori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, void *); -static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, void *); +static void HDF5_Fsync(void *, airori_mod_opt_t *); +static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, airori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); -static int HDF5_check_params(void * options); +static int HDF5_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -107,7 +107,7 @@ typedef struct{ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ -static option_help * HDF5_options(void ** init_backend_options, void * init_values){ +static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ HDF5_options_t * o = malloc(sizeof(HDF5_options_t)); if (init_values != NULL){ @@ -119,7 +119,7 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu o->setAlignment = 1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, @@ -173,7 +173,7 @@ static void HDF5_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int HDF5_check_params(void * options){ +static int HDF5_check_params(airori_mod_opt_t * options){ HDF5_options_t *o = (HDF5_options_t*) options; if (o->setAlignment < 0) ERR("alignment must be non-negative integer"); @@ -197,7 +197,7 @@ static int HDF5_check_params(void * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, void * param) +static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, void * param) /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, void * param) +static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -417,7 +417,7 @@ static void *HDF5_Open(char *testFileName, int flags, void * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -495,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, void * param) +static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) { ; } @@ -503,7 +503,7 @@ static void HDF5_Fsync(void *fd, void * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, void * param) +static void HDF5_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, void * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, void * param) +static void HDF5_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return @@ -558,7 +558,7 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - void * param) + airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; @@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, void * param) +static void SetupDataSet(void *fd, airori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, void * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) return 0; @@ -671,7 +671,7 @@ HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, void *param) +static int HDF5_Access(const char *path, int mode, airori_mod_opt_t *param) { if(ior_param->dryRun) return 0; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 10c196e..81e7a81 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,15 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, void *); -static void *MMAP_Open(char *, int flags, void *); +static void *MMAP_Create(char *, int flags, airori_mod_opt_t *); +static void *MMAP_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MMAP_Close(void *, void *); -static void MMAP_Fsync(void *, void *); -static option_help * MMAP_options(void ** init_backend_options, void * init_values); + IOR_offset_t, airori_mod_opt_t *); +static void MMAP_Close(void *, airori_mod_opt_t *); +static void MMAP_Fsync(void *, airori_mod_opt_t *); +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); -static int MMAP_check_params(void * options); +static int MMAP_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -61,7 +61,7 @@ typedef struct{ int madv_pattern; } mmap_options_t; -static option_help * MMAP_options(void ** init_backend_options, void * init_values){ +static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mmap_options_t * o = malloc(sizeof(mmap_options_t)); if (init_values != NULL){ @@ -70,7 +70,7 @@ static option_help * MMAP_options(void ** init_backend_options, void * init_valu memset(o, 0, sizeof(mmap_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, @@ -89,7 +89,7 @@ static void MMAP_init_xfer_options(IOR_param_t * params){ aiori_posix_init_xfer_options(params); } -static int MMAP_check_params(void * options){ +static int MMAP_check_params(airori_mod_opt_t * options){ if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; @@ -130,7 +130,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, void * param) +static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; @@ -144,7 +144,7 @@ static void *MMAP_Create(char *testFileName, int flags, void * param) /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, void * param) +static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int *fd; fd = POSIX_Open(testFileName, flags, param); @@ -156,7 +156,7 @@ static void *MMAP_Open(char *testFileName, int flags, void * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, void * param) +static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, void * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, void * param) +static void MMAP_Close(void *fd, airori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 5c8a012..6a22170 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,20 +31,26 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, void *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, airori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, void *); -static void *MPIIO_Open(char *, int flags, void *); +static void *MPIIO_Create(char *, int iorflags, airori_mod_opt_t *); +static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void MPIIO_Close(void *, void *); + IOR_offset_t, airori_mod_opt_t *); +static void MPIIO_Close(void *, airori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, void *); +static void MPIIO_Fsync(void *, airori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); -static int MPIIO_check_params(void * options); +static int MPIIO_check_params(airori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ +typedef struct{ + MPI_File fd; + MPI_Datatype transferType; /* datatype for transfer */ + MPI_Datatype fileType; /* filetype for file view */ +} mpiio_fd_t; + typedef struct { int dry_run; int showHints; /* show hints */ @@ -55,14 +61,14 @@ typedef struct { char * hintsFileName; /* full name for hints file */ } mpiio_options_t; -static option_help * MPIIO_options(void ** init_backend_options, void * init_values){ +static option_help * MPIIO_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(mpiio_options_t)); }else{ memset(o, 0, sizeof(mpiio_options_t)); } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, @@ -108,7 +114,7 @@ static void MPIIO_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int MPIIO_check_params(void * module_options){ +static int MPIIO_check_params(airori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ @@ -134,7 +140,7 @@ static int MPIIO_check_params(void * module_options){ /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, void *module_options) +int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run){ @@ -166,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, void *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, void * module_options) +static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -174,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, void * module_option /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, void * module_options) +static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -184,16 +190,12 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; - MPI_File *fd; + + mpiio_fd_t * mfd = malloc(sizeof(mpiio_fd_t)); + memset(mfd, 0, sizeof(mpiio_fd_t)); MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - fd = (MPI_File *) malloc(sizeof(MPI_File)); - if (fd == NULL) - ERR("malloc failed()"); - - *fd = 0; - /* set IOR file flags to MPIIO flags */ /* -- file open flags -- */ if (flags & IOR_RDONLY) { @@ -214,9 +216,6 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) if (flags & IOR_EXCL) { fd_mode |= MPI_MODE_EXCL; } - if (flags & IOR_TRUNC) { - fprintf(stdout, "File truncation not implemented in MPIIO\n"); - } if (flags & IOR_DIRECT) { fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); } @@ -248,15 +247,18 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) fprintf(stdout, "}\n"); } if(! param->dry_run){ - MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd), + MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd), "cannot open file: %s", testFileName); + if (flags & IOR_TRUNC) { + MPI_CHECKF(MPI_File_set_size(mfd->fd, 0), "cannot truncate file: %s", testFileName); + } } /* show hints actually attached to file handle */ if (rank == 0 && param->showHints && ! param->dry_run) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), + MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints), "cannot get file info"); fprintf(stdout, "\nhints returned from opened file {\n"); ShowHints(&mpiHints); @@ -265,7 +267,7 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* preallocate space for file */ if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { - MPI_CHECK(MPI_File_preallocate(*fd, + MPI_CHECK(MPI_File_preallocate(mfd->fd, (MPI_Offset) (ior_param->segmentCount * ior_param->blockSize * @@ -277,9 +279,9 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous (ior_param->transferSize / sizeof(IOR_size_t), - MPI_LONG_LONG_INT, &ior_param->transferType), + MPI_LONG_LONG_INT, & mfd->transferType), "cannot create contiguous datatype"); - MPI_CHECK(MPI_Type_commit(&ior_param->transferType), + MPI_CHECK(MPI_Type_commit(& mfd->transferType), "cannot commit datatype"); if (ior_param->filePerProc) { offsetFactor = 0; @@ -305,29 +307,29 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options) (2, fileTypeStruct.globalSizes, fileTypeStruct.localSizes, fileTypeStruct.startIndices, MPI_ORDER_C, - ior_param->transferType, &ior_param->fileType), + mfd->transferType, & mfd->fileType), "cannot create subarray"); - MPI_CHECK(MPI_Type_commit(&ior_param->fileType), + MPI_CHECK(MPI_Type_commit(& mfd->fileType), "cannot commit datatype"); if(! param->dry_run){ - MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, - ior_param->transferType, - ior_param->fileType, "native", + MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0, + mfd->transferType, + mfd->fileType, "native", (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } } if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - return ((void *)fd); + return ((void *) mfd); } /* * Write or read access to file using the MPIIO interface. */ -static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, void * module_options) +static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, + IOR_offset_t length, airori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -336,6 +338,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return length; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; int (MPIAPI * Access) (MPI_File, void *, int, MPI_Datatype, MPI_Status *); @@ -385,7 +388,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < + if (SeekOffset(mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -404,14 +407,14 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* individual, collective call */ MPI_CHECK(Access_all - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access collective"); } else { /* individual, noncollective call */ MPI_CHECK(Access - (*(MPI_File *) fd, buffer, length, - ior_param->transferType, &status), + (mfd->fd, buffer, length, + mfd->transferType, &status), "cannot access noncollective"); } length *= ior_param->transferSize; /* for return value in bytes */ @@ -424,7 +427,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (*(MPI_File *) fd, ior_param->offset, param) < 0) { + (mfd->fd, ior_param->offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -443,13 +446,13 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, if (ior_param->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (*(MPI_File *) fd, ior_param->offset, + (mfd->fd, ior_param->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } @@ -461,40 +464,40 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, void * module_options) +static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) return; - if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS) + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; + if (MPI_File_sync(mfd->fd) != MPI_SUCCESS) EWARN("fsync() failed"); } /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fd, void * module_options) +static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; + mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; if(! param->dry_run){ - MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file"); + MPI_CHECK(MPI_File_close(& mfd->fd), "cannot close file"); } - //if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) { - // /* - // * need to free the datatype, so done in the close process - // */ - // MPI_CHECK(MPI_Type_free(¶m->fileType), - // "cannot free MPI file datatype"); - // MPI_CHECK(MPI_Type_free(¶m->transferType), - // "cannot free MPI transfer datatype"); - //} - free(fd); + if (param->useFileView == TRUE) { + /* + * need to free the datatype, so done in the close process + */ + MPI_CHECK(MPI_Type_free(& mfd->fileType), "cannot free MPI file datatype"); + MPI_CHECK(MPI_Type_free(& mfd->transferType), "cannot free MPI transfer datatype"); + } + free(fdp); } /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, void * module_options) +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -519,7 +522,7 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - void * module_options) + airori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; @@ -561,7 +564,7 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(void * module_options, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * module_options, MPI_Comm testComm, char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index b7b01e4..20f37f4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,10 +69,10 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, void *); -static void POSIX_Fsync(void *, void *); -static void POSIX_Sync(void * ); -static int POSIX_check_params(void * options); + IOR_offset_t, airori_mod_opt_t *); +static void POSIX_Fsync(void *, airori_mod_opt_t *); +static void POSIX_Sync(airori_mod_opt_t * ); +static int POSIX_check_params(airori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -97,7 +97,7 @@ typedef struct{ } posix_options_t; -option_help * POSIX_options(void ** init_backend_options, void * init_values){ +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ posix_options_t * o = malloc(sizeof(posix_options_t)); if (init_values != NULL){ @@ -110,7 +110,7 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){ o->beegfs_chunkSize = -1; } - *init_backend_options = o; + *init_backend_options = (airori_mod_opt_t*) o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, @@ -172,7 +172,7 @@ void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int POSIX_check_params(void * param){ +static int POSIX_check_params(airori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; if (ior_param->useExistingTestFile && o->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, void * param) +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, void * param) +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -549,7 +549,7 @@ void *POSIX_Open(char *testFileName, int flags, void * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, void * param) + IOR_offset_t length, airori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -634,14 +634,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, void * param) +static void POSIX_Fsync(void *fd, airori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(void * param) +static void POSIX_Sync(airori_mod_opt_t * param) { int ret = system("sync"); if (ret != 0){ @@ -653,7 +653,7 @@ static void POSIX_Sync(void * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, void * param) +void POSIX_Close(void *fd, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -665,7 +665,7 @@ void POSIX_Close(void *fd, void * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, void * param) +void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, void * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) diff --git a/src/aiori.c b/src/aiori.c index 592c503..42eb871 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * m return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options) +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, void * module_options) +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, void * module_options) +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options) +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options) { return stat (path, buf); } diff --git a/src/aiori.h b/src/aiori.h index f99c424..dab41c6 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -63,35 +63,40 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; +/* this is a dummy structure to create some type safety */ +typedef struct airori_mod_opt_t{ + void * dummy; +} airori_mod_opt_t; + typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, void *); + void *(*create)(char *, int iorflags, airori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, void *); + void *(*open)(char *, int iorflags, airori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, void *); - void (*close)(void *, void *); - void (*delete)(char *, void *); + IOR_offset_t, airori_mod_opt_t *); + void (*close)(void *, airori_mod_opt_t *); + void (*delete)(char *, airori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, void *); - IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); - int (*mkdir) (const char *path, mode_t mode, void * module_options); - int (*rmdir) (const char *path, void * module_options); - int (*access) (const char *path, int mode, void * module_options); - int (*stat) (const char *path, struct stat *buf, void * module_options); - void (*initialize)(void * options); /* called once per program before MPI is started */ - void (*finalize)(void * options); /* called once per program after MPI is shutdown */ - option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + void (*fsync)(void *, airori_mod_opt_t *); + IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options); + int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options); + int (*rmdir) (const char *path, airori_mod_opt_t * module_options); + int (*access) (const char *path, int mode, airori_mod_opt_t * module_options); + int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options); + void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */ + void (*finalize)(airori_mod_opt_t * options); /* called once per program after MPI is shutdown */ + option_help * (*get_options)(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + int (*check_params)(airori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(airori_mod_opt_t * ); /* synchronize every pending operation for this storage */ bool enable_mdtest; - int (*check_params)(void *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(void * ); /* synchronize every pending operation for this storage */ } ior_aiori_t; enum bench_type { @@ -127,26 +132,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, void * module_options); -int aiori_posix_mkdir (const char *path, mode_t mode, void * module_options); -int aiori_posix_rmdir (const char *path, void * module_options); -int aiori_posix_access (const char *path, int mode, void * module_options); -int aiori_posix_stat (const char *path, struct stat *buf, void * module_options); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options); +int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options); +int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, void * module_options); +void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, void * module_options); -IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, void * module_options); -void POSIX_Close(void *fd, void * module_options); -option_help * POSIX_options(void ** init_backend_options, void * init_values); +void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options); +IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options); +void POSIX_Close(void *fd, airori_mod_opt_t * module_options); +option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, void * module_options); -IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, - char *testFileName); -int MPIIO_Access(const char *, int, void *); +void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options); +IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); +int MPIIO_Access(const char *, int, airori_mod_opt_t *); #endif /* not _AIORI_H */ diff --git a/src/ior.c b/src/ior.c index 59fc26b..3323b7f 100755 --- a/src/ior.c +++ b/src/ior.c @@ -824,15 +824,15 @@ static char *PrependDir(IOR_param_t * test, char *rootDir) sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks); /* dir doesn't exist, so create */ - if (backend->access(dir, F_OK, test) != 0) { - if (backend->mkdir(dir, S_IRWXU, test) < 0) { + if (backend->access(dir, F_OK, test->backend_options) != 0) { + if (backend->mkdir(dir, S_IRWXU, test->backend_options) < 0) { ERRF("cannot create directory: %s", dir); } /* check if correct permissions */ - } else if (backend->access(dir, R_OK, test) != 0 || - backend->access(dir, W_OK, test) != 0 || - backend->access(dir, X_OK, test) != 0) { + } else if (backend->access(dir, R_OK, test->backend_options) != 0 || + backend->access(dir, W_OK, test->backend_options) != 0 || + backend->access(dir, X_OK, test->backend_options) != 0) { ERRF("invalid directory permissions: %s", dir); } @@ -919,24 +919,24 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test) rankOffset = 0; GetTestFileName(testFileName, test); } - if (backend->access(testFileName, F_OK, test) == 0) { + if (backend->access(testFileName, F_OK, test->backend_options) == 0) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } if (test->reorderTasksRandom == TRUE) { rankOffset = tmpRankOffset; GetTestFileName(testFileName, test); } } else { - if ((rank == 0) && (backend->access(testFileName, F_OK, test) == 0)) { + if ((rank == 0) && (backend->access(testFileName, F_OK, test->backend_options) == 0)) { if (verbose >= VERBOSE_3) { fprintf(out_logfile, "task %d removing %s\n", rank, testFileName); } - backend->delete(testFileName, test); + backend->delete(testFileName, test->backend_options); } } } @@ -1359,14 +1359,14 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + backend->close(fd, params->backend_options); 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, testComm, testFileName); + 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 */ @@ -1412,9 +1412,9 @@ static void TestIoSys(IOR_test_t *test) GetTestFileName(testFileName, params); params->open = WRITECHECK; - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers); - backend->close(fd, params); + backend->close(fd, params->backend_options); rankOffset = 0; } /* @@ -1484,7 +1484,7 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); params->open = READ; timer[0] = GetTimeStamp(); - fd = backend->open(testFileName, IOR_RDONLY, params); + fd = backend->open(testFileName, IOR_RDONLY, params->backend_options); timer[1] = GetTimeStamp(); if (params->intraTestBarriers) MPI_CHECK(MPI_Barrier(testComm), @@ -1501,12 +1501,12 @@ static void TestIoSys(IOR_test_t *test) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); timer[4] = GetTimeStamp(); - backend->close(fd, params); + 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, testComm, + backend->get_file_size(params->backend_options, testComm, testFileName); /* check if stat() of file doesn't equal expected file size, @@ -1809,8 +1809,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset nanosleep( & wait, NULL); } } else if (access == READ) { - amtXferred = - backend->xfer(access, fd, buffer, transfer, test); + amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file"); if (test->interIODelay > 0){ @@ -1824,7 +1823,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset FillBuffer(readCheckBuffer, test, test->offset, pretendRank); } - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file write check"); (*transferCount)++; @@ -1834,7 +1833,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset } else if (access == READCHECK) { memset(checkBuffer, 'a', transfer); - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); if (amtXferred != transfer){ ERR("cannot read from file"); } @@ -1931,7 +1930,7 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, free(offsetArray); if (access == WRITE && test->fsync == TRUE) { - backend->fsync(fd, test); /*fsync after all accesses */ + backend->fsync(fd, test->backend_options); /*fsync after all accesses */ } return (dataMoved); } diff --git a/src/ior.h b/src/ior.h index f09d617..d208507 100755 --- a/src/ior.h +++ b/src/ior.h @@ -94,6 +94,7 @@ typedef struct char * options; /* options string */ // intermediate options int collective; /* collective I/O */ + MPI_Comm testComm; /* MPI communicator */ int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ int numTasks; /* number of tasks for test */ int numNodes; /* number of nodes for test */ @@ -155,11 +156,6 @@ typedef struct int fsyncPerWrite; /* fsync() after each write */ int fsync; /* fsync() after write */ - /* MPI variables */ - MPI_Comm testComm; /* MPI communicator */ - MPI_Datatype transferType; /* datatype for transfer */ - MPI_Datatype fileType; /* filetype for file view */ - /* HDFS variables */ char * hdfs_user; /* copied from ENV, for now */ const char* hdfs_name_node; diff --git a/src/mdtest.c b/src/mdtest.c index bdd70c9..b81b143 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -2143,8 +2143,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * } /* if directory does not exist, create it */ - if ((rank < path_count) && backend->access(testdirpath, F_OK, ¶m) != 0) { - if (backend->mkdir(testdirpath, DIRMODE, ¶m) != 0) { + if ((rank < path_count) && backend->access(testdirpath, F_OK, backend_options) != 0) { + if (backend->mkdir(testdirpath, DIRMODE, backend_options) != 0) { FAIL("Unable to create test directory path %s", testdirpath); } } diff --git a/src/option.h b/src/option.h index 624da51..9c2dffd 100644 --- a/src/option.h +++ b/src/option.h @@ -23,10 +23,12 @@ typedef struct{ void * variable; } option_help; +typedef struct airori_mod_opt_t airori_mod_opt_t; + typedef struct{ char * prefix; // may be NULL to include it in the standard name option_help * options; - void * defaults; // these default values are taken from the command line + airori_mod_opt_t * defaults; // these default values are taken from the command line } option_module; typedef struct{ From c4c19d3245cf4a4e29be4fbe9963b883fcd1fcce Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 11:58:34 +0100 Subject: [PATCH 06/11] Fixed type typo in name. --- src/aiori-DUMMY.c | 36 +++++++++++------------ src/aiori-HDF5.c | 48 +++++++++++++++---------------- src/aiori-MMAP.c | 30 +++++++++---------- src/aiori-MPIIO.c | 38 ++++++++++++------------ src/aiori-POSIX.c | 30 +++++++++---------- src/aiori.c | 10 +++---- src/aiori.h | 73 ++++++++++++++++++++++++----------------------- src/option.h | 4 +-- 8 files changed, 136 insertions(+), 133 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index 766a2c0..ce8933c 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -25,7 +25,7 @@ typedef struct { static char * current = (char*) 1; -static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * DUMMY_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ dummy_options_t * o = malloc(sizeof(dummy_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(dummy_options_t)); @@ -33,7 +33,7 @@ static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, air memset(o, 0, sizeof(dummy_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, @@ -48,7 +48,7 @@ static option_help * DUMMY_options(airori_mod_opt_t ** init_backend_options, air static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * options) +static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -66,7 +66,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, airori_mod_opt_t * o return current++; } -static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * options) +static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, airori_mod_opt_t * option return current++; } -static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) +static void DUMMY_Fsync(void *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -85,18 +85,18 @@ static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options) } -static void DUMMY_Sync(airori_mod_opt_t * options) +static void DUMMY_Sync(aiori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, airori_mod_opt_t * options) +static void DUMMY_Close(void *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); } } -static void DUMMY_Delete(char *testFileName, airori_mod_opt_t * options) +static void DUMMY_Delete(char *testFileName, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); @@ -108,7 +108,7 @@ static char * DUMMY_getVersion() return "0.5"; } -static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) +static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testComm, char *testFileName) { if(verbose > 4){ fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(airori_mod_opt_t * options, MPI_Comm testC return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, airori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } @@ -130,7 +130,7 @@ static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_ return length; } -static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mod_opt_t * options){ +static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, aiori_mod_opt_t * options){ stat->f_bsize = 1; stat->f_blocks = 1; stat->f_bfree = 1; @@ -140,32 +140,32 @@ static int DUMMY_statfs (const char * path, ior_aiori_statfs_t * stat, airori_mo return 0; } -static int DUMMY_mkdir (const char *path, mode_t mode, airori_mod_opt_t * options){ +static int DUMMY_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_rmdir (const char *path, airori_mod_opt_t * options){ +static int DUMMY_rmdir (const char *path, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_access (const char *path, int mode, airori_mod_opt_t * options){ +static int DUMMY_access (const char *path, int mode, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_stat (const char *path, struct stat *buf, airori_mod_opt_t * options){ +static int DUMMY_stat (const char *path, struct stat *buf, aiori_mod_opt_t * options){ return 0; } -static int DUMMY_check_params(airori_mod_opt_t * options){ +static int DUMMY_check_params(aiori_mod_opt_t * options){ return 0; } -static void DUMMY_init(airori_mod_opt_t * options){ +static void DUMMY_init(aiori_mod_opt_t * options){ WARN("DUMMY initialized"); count_init++; } -static void DUMMY_final(airori_mod_opt_t * options){ +static void DUMMY_final(aiori_mod_opt_t * options){ WARN("DUMMY finalized"); if(count_init <= 0){ ERR("DUMMY invalid finalization\n"); diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index e66e5d4..203aa3f 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -81,20 +81,20 @@ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *); -static void SetupDataSet(void *, airori_mod_opt_t *); -static void *HDF5_Create(char *, int flags, airori_mod_opt_t *); -static void *HDF5_Open(char *, int flags, airori_mod_opt_t *); +static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); +static void SetupDataSet(void *, aiori_mod_opt_t *); +static void *HDF5_Create(char *, int flags, aiori_mod_opt_t *); +static void *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void HDF5_Close(void *, airori_mod_opt_t *); -static void HDF5_Delete(char *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); +static void HDF5_Close(void *, aiori_mod_opt_t *); +static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, airori_mod_opt_t *); -static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *); -static int HDF5_Access(const char *, int, airori_mod_opt_t *); +static void HDF5_Fsync(void *, aiori_mod_opt_t *); +static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); +static int HDF5_Access(const char *, int, aiori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); -static int HDF5_check_params(airori_mod_opt_t * options); +static int HDF5_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -107,7 +107,7 @@ typedef struct{ } HDF5_options_t; /***************************** F U N C T I O N S ******************************/ -static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * HDF5_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ HDF5_options_t * o = malloc(sizeof(HDF5_options_t)); if (init_values != NULL){ @@ -119,7 +119,7 @@ static option_help * HDF5_options(airori_mod_opt_t ** init_backend_options, airo o->setAlignment = 1; } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, @@ -173,7 +173,7 @@ static void HDF5_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int HDF5_check_params(airori_mod_opt_t * options){ +static int HDF5_check_params(aiori_mod_opt_t * options){ HDF5_options_t *o = (HDF5_options_t*) options; if (o->setAlignment < 0) ERR("alignment must be non-negative integer"); @@ -197,7 +197,7 @@ static int HDF5_check_params(airori_mod_opt_t * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param) +static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, airori_mod_opt_t * param /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) +static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -417,7 +417,7 @@ static void *HDF5_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -495,7 +495,7 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) +static void HDF5_Fsync(void *fd, aiori_mod_opt_t * param) { ; } @@ -503,7 +503,7 @@ static void HDF5_Fsync(void *fd, airori_mod_opt_t * param) /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, airori_mod_opt_t * param) +static void HDF5_Close(void *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, airori_mod_opt_t * param) /* * Delete a file through the HDF5 interface. */ -static void HDF5_Delete(char *testFileName, airori_mod_opt_t * param) +static void HDF5_Delete(char *testFileName, aiori_mod_opt_t * param) { if(ior_param->dryRun) return @@ -558,7 +558,7 @@ static char * HDF5_GetVersion() * Seek to offset in file using the HDF5 interface and set up hyperslab. */ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, - airori_mod_opt_t * param) + aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; IOR_offset_t segmentSize; @@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, airori_mod_opt_t * param) +static void SetupDataSet(void *fd, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, airori_mod_opt_t * param) * Use MPIIO call to get file size. */ static IOR_offset_t -HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) +HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) return 0; @@ -671,7 +671,7 @@ HDF5_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) /* * Use MPIIO call to check for access. */ -static int HDF5_Access(const char *path, int mode, airori_mod_opt_t *param) +static int HDF5_Access(const char *path, int mode, aiori_mod_opt_t *param) { if(ior_param->dryRun) return 0; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 81e7a81..5a920a7 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,15 +26,15 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, airori_mod_opt_t *); -static void *MMAP_Open(char *, int flags, airori_mod_opt_t *); +static void *MMAP_Create(char *, int flags, aiori_mod_opt_t *); +static void *MMAP_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void MMAP_Close(void *, airori_mod_opt_t *); -static void MMAP_Fsync(void *, airori_mod_opt_t *); -static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); + IOR_offset_t, aiori_mod_opt_t *); +static void MMAP_Close(void *, aiori_mod_opt_t *); +static void MMAP_Fsync(void *, aiori_mod_opt_t *); +static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); -static int MMAP_check_params(airori_mod_opt_t * options); +static int MMAP_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t mmap_aiori = { @@ -61,7 +61,7 @@ typedef struct{ int madv_pattern; } mmap_options_t; -static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ mmap_options_t * o = malloc(sizeof(mmap_options_t)); if (init_values != NULL){ @@ -70,7 +70,7 @@ static option_help * MMAP_options(airori_mod_opt_t ** init_backend_options, airo memset(o, 0, sizeof(mmap_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, @@ -89,7 +89,7 @@ static void MMAP_init_xfer_options(IOR_param_t * params){ aiori_posix_init_xfer_options(params); } -static int MMAP_check_params(airori_mod_opt_t * options){ +static int MMAP_check_params(aiori_mod_opt_t * options){ if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; @@ -130,7 +130,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param) +static void *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; @@ -144,7 +144,7 @@ static void *MMAP_Create(char *testFileName, int flags, airori_mod_opt_t * param /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) +static void *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; fd = POSIX_Open(testFileName, flags, param); @@ -156,7 +156,7 @@ static void *MMAP_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) +static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, airori_mod_opt_t * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, airori_mod_opt_t * param) +static void MMAP_Close(void *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 6a22170..f366872 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -31,17 +31,17 @@ /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, airori_mod_opt_t *); +static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, airori_mod_opt_t *); -static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *); +static void *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); +static void *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void MPIIO_Close(void *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); +static void MPIIO_Close(void *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, airori_mod_opt_t *); +static void MPIIO_Fsync(void *, aiori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); -static int MPIIO_check_params(airori_mod_opt_t * options); +static int MPIIO_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -61,14 +61,14 @@ typedef struct { char * hintsFileName; /* full name for hints file */ } mpiio_options_t; -static option_help * MPIIO_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +static option_help * MPIIO_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ mpiio_options_t * o = malloc(sizeof(mpiio_options_t)); if (init_values != NULL){ memcpy(o, init_values, sizeof(mpiio_options_t)); }else{ memset(o, 0, sizeof(mpiio_options_t)); } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, @@ -114,7 +114,7 @@ static void MPIIO_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int MPIIO_check_params(airori_mod_opt_t * module_options){ +static int MPIIO_check_params(aiori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ @@ -140,7 +140,7 @@ static int MPIIO_check_params(airori_mod_opt_t * module_options){ /* * Try to access a file through the MPIIO interface. */ -int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) +int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run){ @@ -172,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, airori_mod_opt_t *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * module_options) +static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -180,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, airori_mod_opt_t * m /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module_options) +static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -329,7 +329,7 @@ static void *MPIIO_Open(char *testFileName, int flags, airori_mod_opt_t * module * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * module_options) + IOR_offset_t length, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -464,7 +464,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) +static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -477,7 +477,7 @@ static void MPIIO_Fsync(void *fdp, airori_mod_opt_t * module_options) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) +static void MPIIO_Close(void *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; @@ -497,7 +497,7 @@ static void MPIIO_Close(void *fdp, airori_mod_opt_t * module_options) /* * Delete a file through the MPIIO interface. */ -void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options) +void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -522,7 +522,7 @@ static char* MPIIO_GetVersion() * Seek to offset in file using the MPIIO interface. */ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, - airori_mod_opt_t * module_options) + aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int offsetFactor, tasksPerFile; @@ -564,7 +564,7 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, * Use MPI_File_get_size() to return aggregate file size. * NOTE: This function is used by the HDF5 and NCMPI backends. */ -IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * module_options, MPI_Comm testComm, +IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testComm, char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 20f37f4..4ecc557 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,10 +69,10 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); -static void POSIX_Fsync(void *, airori_mod_opt_t *); -static void POSIX_Sync(airori_mod_opt_t * ); -static int POSIX_check_params(airori_mod_opt_t * options); + IOR_offset_t, aiori_mod_opt_t *); +static void POSIX_Fsync(void *, aiori_mod_opt_t *); +static void POSIX_Sync(aiori_mod_opt_t * ); +static int POSIX_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ typedef struct{ @@ -97,7 +97,7 @@ typedef struct{ } posix_options_t; -option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values){ +option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values){ posix_options_t * o = malloc(sizeof(posix_options_t)); if (init_values != NULL){ @@ -110,7 +110,7 @@ option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod o->beegfs_chunkSize = -1; } - *init_backend_options = (airori_mod_opt_t*) o; + *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { {0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, @@ -172,7 +172,7 @@ void aiori_posix_init_xfer_options(IOR_param_t * params){ ior_param = params; } -static int POSIX_check_params(airori_mod_opt_t * param){ +static int POSIX_check_params(aiori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; if (ior_param->useExistingTestFile && o->lustre_set_striping) ERR("Lustre stripe options are incompatible with useExistingTestFile"); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * param) +void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) +void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -549,7 +549,7 @@ void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, - IOR_offset_t length, airori_mod_opt_t * param) + IOR_offset_t length, aiori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -634,14 +634,14 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, airori_mod_opt_t * param) +static void POSIX_Fsync(void *fd, aiori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); } -static void POSIX_Sync(airori_mod_opt_t * param) +static void POSIX_Sync(aiori_mod_opt_t * param) { int ret = system("sync"); if (ret != 0){ @@ -653,7 +653,7 @@ static void POSIX_Sync(airori_mod_opt_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, airori_mod_opt_t * param) +void POSIX_Close(void *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -665,7 +665,7 @@ void POSIX_Close(void *fd, airori_mod_opt_t * param) /* * Delete a file through the POSIX interface. */ -void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) +void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; @@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, airori_mod_opt_t * param) /* * Use POSIX stat() to return aggregate file size. */ -IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, +IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { if(ior_param->dryRun) diff --git a/src/aiori.c b/src/aiori.c index 42eb871..be9c2b4 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -152,7 +152,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) * This function provides a AIORI statfs for POSIX-compliant filesystems. It * uses statvfs is available and falls back on statfs. */ -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options) +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options) { int ret; #if defined(HAVE_STATVFS) @@ -177,22 +177,22 @@ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_m return 0; } -int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options) +int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options) { return mkdir (path, mode); } -int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options) +int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options) { return rmdir (path); } -int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options) +int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options) { return access (path, mode); } -int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options) +int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options) { return stat (path, buf); } diff --git a/src/aiori.h b/src/aiori.h index dab41c6..7662e8f 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -63,39 +63,42 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; -/* this is a dummy structure to create some type safety */ -typedef struct airori_mod_opt_t{ - void * dummy; -} airori_mod_opt_t; +typedef struct aiori_xfer_hint_t{ +} aiori_xfer_hint_t; + +/* this is a dummy structure to create some type safety */ +typedef struct aiori_mod_opt_t{ + void * dummy; +} aiori_mod_opt_t; typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, airori_mod_opt_t *); + void *(*create)(char *, int iorflags, aiori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, airori_mod_opt_t *); + void *(*open)(char *, int iorflags, aiori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); IOR_offset_t (*xfer)(int, void *, IOR_size_t *, - IOR_offset_t, airori_mod_opt_t *); - void (*close)(void *, airori_mod_opt_t *); - void (*delete)(char *, airori_mod_opt_t *); + IOR_offset_t, aiori_mod_opt_t *); + void (*close)(void *, aiori_mod_opt_t *); + void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, airori_mod_opt_t *); - IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *); - int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options); - int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options); - int (*rmdir) (const char *path, airori_mod_opt_t * module_options); - int (*access) (const char *path, int mode, airori_mod_opt_t * module_options); - int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options); - void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */ - void (*finalize)(airori_mod_opt_t * options); /* called once per program after MPI is shutdown */ - option_help * (*get_options)(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ - int (*check_params)(airori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ - void (*sync)(airori_mod_opt_t * ); /* synchronize every pending operation for this storage */ + void (*fsync)(void *, aiori_mod_opt_t *); + IOR_offset_t (*get_file_size)(aiori_mod_opt_t * module_options, MPI_Comm, char *); + int (*statfs) (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t * module_options); + int (*mkdir) (const char *path, mode_t mode, aiori_mod_opt_t * module_options); + int (*rmdir) (const char *path, aiori_mod_opt_t * module_options); + int (*access) (const char *path, int mode, aiori_mod_opt_t * module_options); + int (*stat) (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); + void (*initialize)(aiori_mod_opt_t * options); /* called once per program before MPI is started */ + void (*finalize)(aiori_mod_opt_t * options); /* called once per program after MPI is shutdown */ + option_help * (*get_options)(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */ + int (*check_params)(aiori_mod_opt_t *); /* check if the provided module_optionseters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/ + void (*sync)(aiori_mod_opt_t * ); /* synchronize every pending operation for this storage */ bool enable_mdtest; } ior_aiori_t; @@ -132,25 +135,25 @@ const char *aiori_default (void); /* some generic POSIX-based backend calls */ char * aiori_get_version (void); -int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, airori_mod_opt_t * module_options); -int aiori_posix_mkdir (const char *path, mode_t mode, airori_mod_opt_t * module_options); -int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options); -int aiori_posix_access (const char *path, int mode, airori_mod_opt_t * module_options); -int aiori_posix_stat (const char *path, struct stat *buf, airori_mod_opt_t * module_options); +int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options); +int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options); +int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options); +int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options); +int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, airori_mod_opt_t * module_options); +void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options); -IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); -void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options); -void POSIX_Close(void *fd, airori_mod_opt_t * module_options); -option_help * POSIX_options(airori_mod_opt_t ** init_backend_options, airori_mod_opt_t * init_values); +void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); +IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); +void POSIX_Delete(char *testFileName, aiori_mod_opt_t * module_options); +void POSIX_Close(void *fd, aiori_mod_opt_t * module_options); +option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ -void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options); -IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); -int MPIIO_Access(const char *, int, airori_mod_opt_t *); +void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options); +IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testComm, char *testFileName); +int MPIIO_Access(const char *, int, aiori_mod_opt_t *); #endif /* not _AIORI_H */ diff --git a/src/option.h b/src/option.h index 9c2dffd..5ca305f 100644 --- a/src/option.h +++ b/src/option.h @@ -23,12 +23,12 @@ typedef struct{ void * variable; } option_help; -typedef struct airori_mod_opt_t airori_mod_opt_t; +typedef struct aiori_mod_opt_t aiori_mod_opt_t; typedef struct{ char * prefix; // may be NULL to include it in the standard name option_help * options; - airori_mod_opt_t * defaults; // these default values are taken from the command line + aiori_mod_opt_t * defaults; // these default values are taken from the command line } option_module; typedef struct{ From 8098c3740ad505f615e907a29b460108b4aad024 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 12:11:00 +0100 Subject: [PATCH 07/11] Refactored fd into aiori_fd_t for type safety. --- src/aiori-DUMMY.c | 14 +++++++------- src/aiori-HDF5.c | 23 +++++++++++------------ src/aiori-MMAP.c | 28 ++++++++++++++-------------- src/aiori-MPIIO.c | 20 ++++++++++---------- src/aiori-POSIX.c | 27 ++++++++++++++------------- src/aiori.h | 20 ++++++++++++-------- src/ior.c | 8 ++++---- src/mdtest.c | 6 +++--- 8 files changed, 75 insertions(+), 71 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index ce8933c..2e4feb5 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -48,7 +48,7 @@ static option_help * DUMMY_options(aiori_mod_opt_t ** init_backend_options, aior static int count_init = 0; -static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) +static aiori_fd_t *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in create\n"); @@ -63,10 +63,10 @@ static void *DUMMY_Create(char *testFileName, int iorflags, aiori_mod_opt_t * op nanosleep( & wait, NULL); } } - return current++; + return (aiori_fd_t*) current++; } -static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) +static aiori_fd_t *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options) { if(count_init <= 0){ ERR("DUMMY missing initialization in open\n"); @@ -74,10 +74,10 @@ static void *DUMMY_Open(char *testFileName, int flags, aiori_mod_opt_t * options if(verbose > 4){ fprintf(out_logfile, "DUMMY open: %s = %p\n", testFileName, current); } - return current++; + return (aiori_fd_t*) current++; } -static void DUMMY_Fsync(void *fd, aiori_mod_opt_t * options) +static void DUMMY_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY fsync %p\n", fd); @@ -89,7 +89,7 @@ static void DUMMY_Sync(aiori_mod_opt_t * options) { } -static void DUMMY_Close(void *fd, aiori_mod_opt_t * options) +static void DUMMY_Close(aiori_fd_t *fd, aiori_mod_opt_t * options) { if(verbose > 4){ fprintf(out_logfile, "DUMMY close %p\n", fd); @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testCo return 0; } -static IOR_offset_t DUMMY_Xfer(int access, void *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 203aa3f..6669902 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -83,14 +83,14 @@ static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); static void SetupDataSet(void *, aiori_mod_opt_t *); -static void *HDF5_Create(char *, int flags, aiori_mod_opt_t *); -static void *HDF5_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); +static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void HDF5_Close(void *, aiori_mod_opt_t *); +static void HDF5_Close(aiori_fd_t *, aiori_mod_opt_t *); static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); -static void HDF5_Fsync(void *, aiori_mod_opt_t *); +static void HDF5_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static int HDF5_Access(const char *, int, aiori_mod_opt_t *); static void HDF5_init_xfer_options(IOR_param_t * params); @@ -197,7 +197,7 @@ static int HDF5_check_params(aiori_mod_opt_t * options){ /* * Create and open a file through the HDF5 interface. */ -static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { return HDF5_Open(testFileName, flags, param); } @@ -205,7 +205,7 @@ static void *HDF5_Create(char *testFileName, int flags, aiori_mod_opt_t * param) /* * Open a file through the HDF5 interface. */ -static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; hid_t accessPropList, createPropList; @@ -410,13 +410,13 @@ static void *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * param) if (mpiHints != MPI_INFO_NULL) MPI_Info_free(&mpiHints); - return (fd); + return (aiori_fd_t*)(fd); } /* * Write or read access to file using the HDF5 interface. */ -static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, +static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; @@ -495,15 +495,14 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer, /* * Perform fsync(). */ -static void HDF5_Fsync(void *fd, aiori_mod_opt_t * param) +static void HDF5_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { - ; } /* * Close a file through the HDF5 interface. */ -static void HDF5_Close(void *fd, aiori_mod_opt_t * param) +static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 5a920a7..3b8c203 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -26,12 +26,12 @@ #include "utilities.h" /**************************** P R O T O T Y P E S *****************************/ -static void *MMAP_Create(char *, int flags, aiori_mod_opt_t *); -static void *MMAP_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *MMAP_Create(char *, int flags, aiori_mod_opt_t *); +static aiori_fd_t *MMAP_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void MMAP_Close(void *, aiori_mod_opt_t *); -static void MMAP_Fsync(void *, aiori_mod_opt_t *); +static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); static void MMAP_init_xfer_options(IOR_param_t * params); static int MMAP_check_params(aiori_mod_opt_t * options); @@ -130,32 +130,32 @@ static void ior_mmap_file(int *file, int mflags, void *param) /* * Creat and open a file through the POSIX interface, then setup mmap. */ -static void *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; - fd = POSIX_Create(testFileName, flags, param); + fd = (int*) POSIX_Create(testFileName, flags, param); if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) ERR("ftruncate() failed"); ior_mmap_file(fd, flags, param); - return ((void *)fd); + return ((aiori_fd_t *)fd); } /* * Open a file through the POSIX interface and setup mmap. */ -static void *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +static aiori_fd_t *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int *fd; - fd = POSIX_Open(testFileName, flags, param); + fd = (int*) POSIX_Open(testFileName, flags, param); ior_mmap_file(fd, flags, param); - return ((void *)fd); + return ((aiori_fd_t *)fd); } /* * Write or read access to file using mmap */ -static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, +static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; @@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform msync(). */ -static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) +static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) @@ -188,7 +188,7 @@ static void MMAP_Fsync(void *fd, aiori_mod_opt_t * param) /* * Close a file through the POSIX interface, after tear down the mmap. */ -static void MMAP_Close(void *fd, aiori_mod_opt_t * param) +static void MMAP_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index f366872..81ec0be 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -33,13 +33,13 @@ static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); -static void *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); -static void *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); -static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, +static aiori_fd_t *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); +static aiori_fd_t *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); +static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void MPIIO_Close(void *, aiori_mod_opt_t *); +static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); -static void MPIIO_Fsync(void *, aiori_mod_opt_t *); +static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void MPIIO_init_xfer_options(IOR_param_t * params); static int MPIIO_check_params(aiori_mod_opt_t * options); @@ -172,7 +172,7 @@ int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) /* * Create and open a file through the MPIIO interface. */ -static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) +static aiori_fd_t *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * module_options) { return MPIIO_Open(testFileName, iorflags, module_options); } @@ -180,7 +180,7 @@ static void *MPIIO_Create(char *testFileName, int iorflags, aiori_mod_opt_t * mo /* * Open a file through the MPIIO interface. Setup file view. */ -static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) +static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; int fd_mode = (int)0, @@ -328,7 +328,7 @@ static void *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * module_ /* * Write or read access to file using the MPIIO interface. */ -static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, +static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) @@ -464,7 +464,7 @@ static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer, /* * Perform fsync(). */ -static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) +static void MPIIO_Fsync(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; if(param->dry_run) @@ -477,7 +477,7 @@ static void MPIIO_Fsync(void *fdp, aiori_mod_opt_t * module_options) /* * Close a file through the MPIIO interface. */ -static void MPIIO_Close(void *fdp, aiori_mod_opt_t * module_options) +static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 4ecc557..43c5261 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -68,9 +68,9 @@ #endif /**************************** P R O T O T Y P E S *****************************/ -static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *, +static IOR_offset_t POSIX_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); -static void POSIX_Fsync(void *, aiori_mod_opt_t *); +static void POSIX_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void POSIX_Sync(aiori_mod_opt_t * ); static int POSIX_check_params(aiori_mod_opt_t * options); @@ -372,7 +372,7 @@ bool beegfs_createFilePath(char* filepath, mode_t mode, int numTargets, int chun /* * Creat and open a file through the POSIX interface. */ -void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) +aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int mode = 0664; @@ -387,7 +387,7 @@ void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) } if(ior_param->dryRun) - return 0; + return (aiori_fd_t*) 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H /* Add a #define for FASYNC if not available, as it forms part of @@ -483,7 +483,7 @@ void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) gpfs_free_all_locks(*fd); } #endif - return ((void *)fd); + return (aiori_fd_t*) fd; } /* @@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName) /* * Open a file through the POSIX interface. */ -void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) +aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) { int fd_oflag = O_BINARY; int *fd; @@ -519,7 +519,7 @@ void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) fd_oflag |= O_RDWR; if(ior_param->dryRun) - return 0; + return (aiori_fd_t*) 0; *fd = open64(testFileName, fd_oflag); if (*fd < 0) @@ -542,13 +542,13 @@ void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) gpfs_free_all_locks(*fd); } #endif - return ((void *)fd); + return (aiori_fd_t*) fd; } /* * Write or read access to file using the POSIX interface. */ -static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, +static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * param) { int xferRetries = 0; @@ -587,8 +587,9 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (ior_param->fsyncPerWrite == TRUE) - POSIX_Fsync(&fd, param); + if (ior_param->fsyncPerWrite == TRUE){ + POSIX_Fsync((aiori_fd_t*) &fd, param); + } } else { /* READ or CHECK */ if (verbose >= VERBOSE_4) { fprintf(stdout, @@ -634,7 +635,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer, /* * Perform fsync(). */ -static void POSIX_Fsync(void *fd, aiori_mod_opt_t * param) +static void POSIX_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { if (fsync(*(int *)fd) != 0) EWARNF("fsync(%d) failed", *(int *)fd); @@ -653,7 +654,7 @@ static void POSIX_Sync(aiori_mod_opt_t * param) /* * Close a file through the POSIX interface. */ -void POSIX_Close(void *fd, aiori_mod_opt_t * param) +void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { if(ior_param->dryRun) return; diff --git a/src/aiori.h b/src/aiori.h index 7662e8f..76d9f6a 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -72,22 +72,26 @@ typedef struct aiori_mod_opt_t{ void * dummy; } aiori_mod_opt_t; +typedef struct aiori_fd_t{ + void * dummy; +} aiori_fd_t; + typedef struct ior_aiori { char *name; char *name_legacy; - void *(*create)(char *, int iorflags, aiori_mod_opt_t *); + aiori_fd_t *(*create)(char *, int iorflags, aiori_mod_opt_t *); int (*mknod)(char *); - void *(*open)(char *, int iorflags, aiori_mod_opt_t *); + aiori_fd_t *(*open)(char *, int iorflags, aiori_mod_opt_t *); /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*init_xfer_options)(IOR_param_t * params); - IOR_offset_t (*xfer)(int, void *, IOR_size_t *, + IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); - void (*close)(void *, aiori_mod_opt_t *); + void (*close)(aiori_fd_t *, aiori_mod_opt_t *); void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); - void (*fsync)(void *, aiori_mod_opt_t *); + void (*fsync)(aiori_fd_t *, aiori_mod_opt_t *); IOR_offset_t (*get_file_size)(aiori_mod_opt_t * module_options, MPI_Comm, char *); int (*statfs) (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t * module_options); int (*mkdir) (const char *path, mode_t mode, aiori_mod_opt_t * module_options); @@ -142,12 +146,12 @@ int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_opt int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); void aiori_posix_init_xfer_options(IOR_param_t * params); -void *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); +aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); -void *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); +aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * module_options); IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName); void POSIX_Delete(char *testFileName, aiori_mod_opt_t * module_options); -void POSIX_Close(void *fd, aiori_mod_opt_t * module_options); +void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * module_options); option_help * POSIX_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); diff --git a/src/ior.c b/src/ior.c index 3323b7f..7dbf80b 100755 --- a/src/ior.c +++ b/src/ior.c @@ -55,7 +55,7 @@ static void InitTests(IOR_test_t * , MPI_Comm); static void TestIoSys(IOR_test_t *); static void ValidateTests(IOR_param_t *); static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, - void *fd, const int access, + aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers); static void test_initialize(IOR_test_t * test){ @@ -1231,7 +1231,7 @@ static void TestIoSys(IOR_test_t *test) double startTime; int pretendRank; int rep; - void *fd; + aiori_fd_t *fd; MPI_Group orig_group, new_group; int range[3]; IOR_offset_t dataMoved; /* for data rate calculation */ @@ -1781,7 +1781,7 @@ IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank, int acce } static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offsetArray, int pretendRank, - IOR_offset_t * transferCount, int * errors, IOR_param_t * test, int * 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 transfer; @@ -1850,7 +1850,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset * out the data to each block in transfer sizes, until the remainder left is 0. */ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, - void *fd, const int access, IOR_io_buffers *ioBuffers) + aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers) { int errors = 0; IOR_offset_t transferCount = 0; diff --git a/src/mdtest.c b/src/mdtest.c index b81b143..3e102de 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -346,7 +346,7 @@ static void remove_file (const char *path, uint64_t itemNum) { static void create_file (const char *path, uint64_t itemNum) { char curr_item[MAX_PATHLEN]; - void *aiori_fh = NULL; + aiori_fd_t *aiori_fh = NULL; if ( (itemNum % ITEM_COUNT==0 && (itemNum != 0))) { VERBOSE(3,5,"create file: "LLU"", itemNum); @@ -443,7 +443,7 @@ void collective_helper(const int dirs, const int create, const char* path, uint6 VERBOSE(3,5,"create file: %s", curr_item); if (create) { - void *aiori_fh; + aiori_fd_t *aiori_fh; //create files aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); @@ -622,7 +622,7 @@ void mdtest_stat(const int random, const int dirs, const long dir_iter, const ch void mdtest_read(int random, int dirs, const long dir_iter, char *path) { uint64_t parent_dir, item_num = 0; char item[MAX_PATHLEN], temp[MAX_PATHLEN]; - void *aiori_fh; + aiori_fd_t *aiori_fh; VERBOSE(1,-1,"Entering mdtest_read on %s", path ); From 5663593919f154a5705213c5dcad67dbec467a41 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 12:50:03 +0100 Subject: [PATCH 08/11] Moved generic IOR information to "hint" structure. Backends should only use the "hints" if set. --- src/aiori-HDF5.c | 78 ++++++++++++++++++------------------ src/aiori-MMAP.c | 34 ++++++++-------- src/aiori-MPIIO.c | 100 +++++++++++++++++++++++----------------------- src/aiori-POSIX.c | 46 ++++++++++----------- src/aiori.h | 22 ++++++++-- src/ior.c | 30 +++++++++++--- src/ior.h | 5 ++- src/mdtest.c | 26 ++++++------ 8 files changed, 186 insertions(+), 155 deletions(-) diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index 6669902..cc32cbe 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -82,7 +82,7 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t SeekOffset(void *, IOR_offset_t, aiori_mod_opt_t *); -static void SetupDataSet(void *, aiori_mod_opt_t *); +static void SetupDataSet(void *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, @@ -93,7 +93,7 @@ static char* HDF5_GetVersion(); static void HDF5_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static int HDF5_Access(const char *, int, aiori_mod_opt_t *); -static void HDF5_init_xfer_options(IOR_param_t * params); +static void HDF5_init_xfer_options(aiori_xfer_hint_t * params); static int HDF5_check_params(aiori_mod_opt_t * options); /************************** O P T I O N S *****************************/ @@ -147,7 +147,7 @@ ior_aiori_t hdf5_aiori = { .close = HDF5_Close, .delete = HDF5_Delete, .get_version = HDF5_GetVersion, - .init_xfer_options = HDF5_init_xfer_options, + .xfer_hints = HDF5_init_xfer_options, .fsync = HDF5_Fsync, .get_file_size = HDF5_GetFileSize, .statfs = aiori_posix_statfs, @@ -167,10 +167,10 @@ hid_t memDataSpace; /* memory data space id */ int newlyOpenedFile; /* newly opened file */ /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void HDF5_init_xfer_options(IOR_param_t * params){ - ior_param = params; +static void HDF5_init_xfer_options(aiori_xfer_hint_t * params){ + hints = params; } static int HDF5_check_params(aiori_mod_opt_t * options){ @@ -265,7 +265,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * someday HDF5 implementation will allow subsets of MPI_COMM_WORLD */ /* store MPI communicator info for the file access property list */ - if (ior_param->filePerProc) { + if (hints->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -304,8 +304,8 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa #endif /* open file */ - if(! ior_param->dryRun){ - if (ior_param->open == WRITE) { /* WRITE */ + if(! hints->dryRun){ + if (flags & IOR_CREAT) { /* WRITE */ *fd = H5Fcreate(testFileName, H5F_ACC_TRUNC, createPropList, accessPropList); HDF5_CHECK(*fd, "cannot create file"); } else { /* READ or CHECK */ @@ -365,7 +365,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa HDF5_CHECK(xferPropList, "cannot create transfer property list"); /* set data transfer mode */ - if (ior_param->collective) { + if (hints->collective) { HDF5_CHECK(H5Pset_dxpl_mpio(xferPropList, H5FD_MPIO_COLLECTIVE), "cannot set collective data transfer mode"); } else { @@ -377,9 +377,9 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa /* set up memory data space for transfer */ memStart[0] = (hsize_t) 0; memCount[0] = (hsize_t) 1; - memStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - memBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - memDataSpaceDims[0] = (hsize_t) ior_param->transferSize; + memStride[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + memBlock[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + memDataSpaceDims[0] = (hsize_t) hints->transferSize; memDataSpace = H5Screate_simple(NUM_DIMS, memDataSpaceDims, NULL); HDF5_CHECK(memDataSpace, "cannot create simple memory data space"); @@ -389,7 +389,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa memBlock), "cannot create hyperslab"); /* set up parameters for fpp or different dataset count */ - if (ior_param->filePerProc) { + if (hints->filePerProc) { tasksPerDataSet = 1; } else { if (o->individualDataSets) { @@ -397,10 +397,10 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa tasksPerDataSet = 1; } else { /* share single data set across all tasks in segment */ - tasksPerDataSet = ior_param->numTasks; + tasksPerDataSet = hints->numTasks; } } - dataSetDims[0] = (hsize_t) ((ior_param->blockSize / sizeof(IOR_size_t)) + dataSetDims[0] = (hsize_t) ((hints->blockSize / sizeof(IOR_size_t)) * tasksPerDataSet); /* create a simple data space containing information on size @@ -436,16 +436,16 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, } /* determine by offset if need to start new data set */ - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { segmentPosition = (IOR_offset_t) 0; - segmentSize = ior_param->blockSize; + segmentSize = hints->blockSize; } else { segmentPosition = - (IOR_offset_t) ((rank + rankOffset) % ior_param->numTasks) - * ior_param->blockSize; - segmentSize = (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; + (IOR_offset_t) ((rank + rankOffset) % hints->numTasks) + * hints->blockSize; + segmentSize = (IOR_offset_t) (hints->numTasks) * hints->blockSize; } - if ((IOR_offset_t) ((ior_param->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((hints->offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -457,7 +457,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, } } - if(ior_param->dryRun) + if(hints->dryRun) return length; /* create new data set */ @@ -468,10 +468,10 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, HDF5_CHECK(H5Sclose(fileDataSpace), "cannot close file data space"); } - SetupDataSet(fd, param); + SetupDataSet(fd, access == WRITE ? IOR_CREAT : IOR_RDWR, param); } - SeekOffset(fd, ior_param->offset, param); + SeekOffset(fd, hints->offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; @@ -504,9 +504,9 @@ static void HDF5_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) */ static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; - //if (ior_param->fd_fppReadCheck == NULL) { + //if (hints->fd_fppReadCheck == NULL) { HDF5_CHECK(H5Dclose(dataSet), "cannot close data set"); HDF5_CHECK(H5Sclose(dataSpace), "cannot close data space"); HDF5_CHECK(H5Sclose(fileDataSpace), @@ -525,7 +525,7 @@ static void HDF5_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) */ static void HDF5_Delete(char *testFileName, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return MPIIO_Delete(testFileName, param); return; @@ -564,17 +564,17 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, hsize_t hsStride[NUM_DIMS], hsCount[NUM_DIMS], hsBlock[NUM_DIMS]; hsize_t hsStart[NUM_DIMS]; - if (ior_param->filePerProc == TRUE) { - segmentSize = (IOR_offset_t) ior_param->blockSize; + if (hints->filePerProc == TRUE) { + segmentSize = (IOR_offset_t) hints->blockSize; } else { segmentSize = - (IOR_offset_t) (ior_param->numTasks) * ior_param->blockSize; + (IOR_offset_t) (hints->numTasks) * hints->blockSize; } /* create a hyperslab representing the file data space */ if (o->individualDataSets) { /* start at zero offset if not */ - hsStart[0] = (hsize_t) ((offset % ior_param->blockSize) + hsStart[0] = (hsize_t) ((offset % hints->blockSize) / sizeof(IOR_size_t)); } else { /* start at a unique offset if shared */ @@ -582,8 +582,8 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, (hsize_t) ((offset % segmentSize) / sizeof(IOR_size_t)); } hsCount[0] = (hsize_t) 1; - hsStride[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); - hsBlock[0] = (hsize_t) (ior_param->transferSize / sizeof(IOR_size_t)); + hsStride[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); + hsBlock[0] = (hsize_t) (hints->transferSize / sizeof(IOR_size_t)); /* retrieve data space from data set for hyperslab */ fileDataSpace = H5Dget_space(dataSet); @@ -597,7 +597,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, /* * Create HDF5 data set. */ -static void SetupDataSet(void *fd, aiori_mod_opt_t * param) +static void SetupDataSet(void *fd, int flags, aiori_mod_opt_t * param) { HDF5_options_t *o = (HDF5_options_t*) param; char dataSetName[MAX_STR]; @@ -614,7 +614,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) /* may want to use individual access to each data set someday */ if (o->individualDataSets) { - dataSetID = (rank + rankOffset) % ior_param->numTasks; + dataSetID = (rank + rankOffset) % hints->numTasks; } else { dataSetID = 0; } @@ -622,7 +622,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) sprintf(dataSetName, "%s-%04d.%04d", "Dataset", dataSetID, dataSetSuffix++); - if (ior_param->open == WRITE) { /* WRITE */ + if (flags & IOR_CREAT) { /* WRITE */ /* create data set */ dataSetPropList = H5Pcreate(H5P_DATASET_CREATE); /* check if hdf5 available */ @@ -662,7 +662,7 @@ static void SetupDataSet(void *fd, aiori_mod_opt_t * param) static IOR_offset_t HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; return(MPIIO_GetFileSize(test, testComm, testFileName)); } @@ -672,7 +672,7 @@ HDF5_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) */ static int HDF5_Access(const char *path, int mode, aiori_mod_opt_t *param) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; return(MPIIO_Access(path, mode, param)); } diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 3b8c203..453bc3a 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -33,7 +33,7 @@ static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); -static void MMAP_init_xfer_options(IOR_param_t * params); +static void MMAP_xfer_hints(aiori_xfer_hint_t * params); static int MMAP_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -44,7 +44,7 @@ ior_aiori_t mmap_aiori = { .xfer = MMAP_Xfer, .close = MMAP_Close, .delete = POSIX_Delete, - .init_xfer_options = MMAP_init_xfer_options, + .xfer_hints = MMAP_xfer_hints, .get_version = aiori_get_version, .fsync = MMAP_Fsync, .get_file_size = POSIX_GetFileSize, @@ -82,15 +82,15 @@ static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori return help; } -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void MMAP_init_xfer_options(IOR_param_t * params){ - ior_param = params; - aiori_posix_init_xfer_options(params); +static void MMAP_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; + aiori_posix_xfer_hints(params); } static int MMAP_check_params(aiori_mod_opt_t * options){ - if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1))) + if (hints->fsyncPerWrite && (hints->transferSize & (sysconf(_SC_PAGESIZE) - 1))) ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); return 0; } @@ -98,7 +98,7 @@ static int MMAP_check_params(aiori_mod_opt_t * options){ static void ior_mmap_file(int *file, int mflags, void *param) { int flags = PROT_READ; - IOR_offset_t size = ior_param->expectedAggFileSize; + IOR_offset_t size = hints->expectedAggFileSize; if (mflags & IOR_WRONLY || mflags & IOR_RDWR) flags |= PROT_WRITE; @@ -109,7 +109,7 @@ static void ior_mmap_file(int *file, int mflags, void *param) if (o->mmap_ptr == MAP_FAILED) ERR("mmap() failed"); - if (ior_param->randomOffset) + if (hints->randomOffset) flags = POSIX_MADV_RANDOM; else flags = POSIX_MADV_SEQUENTIAL; @@ -135,7 +135,7 @@ static aiori_fd_t *MMAP_Create(char *testFileName, int flags, aiori_mod_opt_t * int *fd; fd = (int*) POSIX_Create(testFileName, flags, param); - if (ftruncate(*fd, ior_param->expectedAggFileSize) != 0) + if (ftruncate(*fd, hints->expectedAggFileSize) != 0) ERR("ftruncate() failed"); ior_mmap_file(fd, flags, param); return ((aiori_fd_t *)fd); @@ -160,15 +160,15 @@ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + ior_param->offset, buffer, length); + memcpy(o->mmap_ptr + hints->offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + ior_param->offset, length); + memcpy(buffer, o->mmap_ptr + hints->offset, length); } - if (ior_param->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + ior_param->offset, length, MS_SYNC) != 0) + if (hints->fsyncPerWrite == TRUE) { + if (msync(o->mmap_ptr + hints->offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + ior_param->offset, length, + if (posix_madvise(o->mmap_ptr + hints->offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } @@ -181,7 +181,7 @@ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; - if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) + if (msync(o->mmap_ptr, hints->expectedAggFileSize, MS_SYNC) != 0) EWARN("msync() failed"); } @@ -191,7 +191,7 @@ static void MMAP_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) static void MMAP_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; - if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) + if (munmap(o->mmap_ptr, hints->expectedAggFileSize) != 0) ERR("munmap failed"); o->mmap_ptr = NULL; POSIX_Close(fd, param); diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 81ec0be..bc1b8b4 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -40,7 +40,7 @@ static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); -static void MPIIO_init_xfer_options(IOR_param_t * params); +static void MPIIO_xfer_hints(aiori_xfer_hint_t * params); static int MPIIO_check_params(aiori_mod_opt_t * options); /************************** D E C L A R A T I O N S ***************************/ @@ -52,7 +52,6 @@ typedef struct{ } mpiio_fd_t; typedef struct { - int dry_run; int showHints; /* show hints */ int useFileView; /* use MPI_File_set_view */ int preallocate; /* preallocate file size */ @@ -71,7 +70,6 @@ static option_help * MPIIO_options(aiori_mod_opt_t ** init_backend_options, aior *init_backend_options = (aiori_mod_opt_t*) o; option_help h [] = { - {0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, {0, "mpiio.hintsFileName","Full name for hints file", OPTION_OPTIONAL_ARGUMENT, 's', & o->hintsFileName}, {0, "mpiio.showHints", "Show MPI hints", OPTION_FLAG, 'd', & o->showHints}, {0, "mpiio.preallocate", "Preallocate file size", OPTION_FLAG, 'd', & o->preallocate}, @@ -91,7 +89,7 @@ ior_aiori_t mpiio_aiori = { .name_legacy = NULL, .create = MPIIO_Create, .get_options = MPIIO_options, - .init_xfer_options = MPIIO_init_xfer_options, + .xfer_hints = MPIIO_xfer_hints, .open = MPIIO_Open, .xfer = MPIIO_Xfer, .close = MPIIO_Close, @@ -108,30 +106,30 @@ ior_aiori_t mpiio_aiori = { }; /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -static void MPIIO_init_xfer_options(IOR_param_t * params){ - ior_param = params; +static void MPIIO_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; } static int MPIIO_check_params(aiori_mod_opt_t * module_options){ mpiio_options_t * param = (mpiio_options_t*) module_options; if ((param->useFileView == TRUE) && (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ - &&((ior_param->numTasks * ior_param->blockSize) > + &&((hints->numTasks * hints->blockSize) > (2 * (IOR_offset_t) GIBIBYTE))) ERR("segment size must be < 2GiB"); if (param->useSharedFilePointer) ERR("shared file pointer not implemented"); if (param->useStridedDatatype) ERR("strided datatype not implemented"); - if (param->useStridedDatatype && (ior_param->blockSize < sizeof(IOR_size_t) - || ior_param->transferSize < + if (param->useStridedDatatype && (hints->blockSize < sizeof(IOR_size_t) + || hints->transferSize < sizeof(IOR_size_t))) ERR("need larger file size for strided datatype in MPIIO"); - if (ior_param->randomOffset && ior_param->collective) + if (hints->randomOffset && hints->collective) ERR("random offset not available with collective MPIIO"); - if (ior_param->randomOffset && param->useFileView) + if (hints->randomOffset && param->useFileView) ERR("random offset not available with MPIIO fileviews"); return 0; @@ -143,7 +141,7 @@ static int MPIIO_check_params(aiori_mod_opt_t * module_options){ int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run){ + if(hints->dryRun){ return MPI_SUCCESS; } MPI_File fd; @@ -186,7 +184,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m int fd_mode = (int)0, offsetFactor, tasksPerFile, - transfersPerBlock = ior_param->blockSize / ior_param->transferSize; + transfersPerBlock = hints->blockSize / hints->transferSize; struct fileTypeStruct { int globalSizes[2], localSizes[2], startIndices[2]; } fileTypeStruct; @@ -227,7 +225,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m */ fd_mode |= MPI_MODE_UNIQUE_OPEN; - if (ior_param->filePerProc) { + if (hints->filePerProc) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -246,7 +244,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m ShowHints(&mpiHints); fprintf(stdout, "}\n"); } - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd), "cannot open file: %s", testFileName); if (flags & IOR_TRUNC) { @@ -255,7 +253,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m } /* show hints actually attached to file handle */ - if (rank == 0 && param->showHints && ! param->dry_run) { + if (rank == 0 && param->showHints && ! hints->dryRun) { if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints), @@ -266,29 +264,29 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m } /* preallocate space for file */ - if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { + if (param->preallocate && flags & IOR_CREAT && ! hints->dryRun) { MPI_CHECK(MPI_File_preallocate(mfd->fd, - (MPI_Offset) (ior_param->segmentCount + (MPI_Offset) (hints->segmentCount * - ior_param->blockSize * - ior_param->numTasks)), + hints->blockSize * + hints->numTasks)), "cannot preallocate file"); } /* create file view */ if (param->useFileView) { /* create contiguous transfer datatype */ MPI_CHECK(MPI_Type_contiguous - (ior_param->transferSize / sizeof(IOR_size_t), + (hints->transferSize / sizeof(IOR_size_t), MPI_LONG_LONG_INT, & mfd->transferType), "cannot create contiguous datatype"); MPI_CHECK(MPI_Type_commit(& mfd->transferType), "cannot commit datatype"); - if (ior_param->filePerProc) { + if (hints->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % ior_param->numTasks; - tasksPerFile = ior_param->numTasks; + offsetFactor = (rank + rankOffset) % hints->numTasks; + tasksPerFile = hints->numTasks; } /* @@ -312,7 +310,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m MPI_CHECK(MPI_Type_commit(& mfd->fileType), "cannot commit datatype"); - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0, mfd->transferType, mfd->fileType, "native", @@ -336,7 +334,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer will get "assignment from incompatible pointer-type" warnings, if we only use this one set of signatures. */ mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return length; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; @@ -388,7 +386,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(mfd->fd, ior_param->offset, module_options) < + if (SeekOffset(mfd->fd, hints->offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -400,11 +398,11 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer * e.g., 'IOR -s 2 -b 32K -t 32K -a MPIIO -S' */ if (param->useStridedDatatype) { - length = ior_param->segmentCount; + length = hints->segmentCount; } else { length = 1; } - if (ior_param->collective) { + if (hints->collective) { /* individual, collective call */ MPI_CHECK(Access_all (mfd->fd, buffer, length, @@ -417,7 +415,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer mfd->transferType, &status), "cannot access noncollective"); } - length *= ior_param->transferSize; /* for return value in bytes */ + length *= hints->transferSize; /* for return value in bytes */ } } else { /* @@ -427,7 +425,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (mfd->fd, ior_param->offset, module_options) < 0) { + (mfd->fd, hints->offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -443,16 +441,16 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer "useSharedFilePointer not implemented\n"); } } else { - if (ior_param->collective) { + if (hints->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (mfd->fd, ior_param->offset, + (mfd->fd, hints->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (mfd->fd, ior_param->offset, + (mfd->fd, hints->offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } @@ -467,7 +465,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer static void MPIIO_Fsync(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; if (MPI_File_sync(mfd->fd) != MPI_SUCCESS) @@ -481,7 +479,7 @@ static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; mpiio_fd_t * mfd = (mpiio_fd_t*) fdp; - if(! param->dry_run){ + if(! hints->dryRun){ MPI_CHECK(MPI_File_close(& mfd->fd), "cannot close file"); } if (param->useFileView == TRUE) { @@ -500,7 +498,7 @@ static void MPIIO_Close(aiori_fd_t *fdp, aiori_mod_opt_t * module_options) void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options) { mpiio_options_t * param = (mpiio_options_t*) module_options; - if(param->dry_run) + if(hints->dryRun) return; MPI_CHECKF(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL), "cannot delete file: %s", testFileName); @@ -530,29 +528,29 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, tempOffset = offset; - if (ior_param->filePerProc) { + if (hints->filePerProc) { offsetFactor = 0; tasksPerFile = 1; } else { - offsetFactor = (rank + rankOffset) % ior_param->numTasks; - tasksPerFile = ior_param->numTasks; + offsetFactor = (rank + rankOffset) % hints->numTasks; + tasksPerFile = hints->numTasks; } if (param->useFileView) { /* recall that offsets in a file view are counted in units of transfer size */ - if (ior_param->filePerProc) { - tempOffset = tempOffset / ior_param->transferSize; + if (hints->filePerProc) { + tempOffset = tempOffset / hints->transferSize; } else { /* * this formula finds a file view offset for a task * from an absolute offset */ - tempOffset = ((ior_param->blockSize / ior_param->transferSize) + tempOffset = ((hints->blockSize / hints->transferSize) * (tempOffset / - (ior_param->blockSize * tasksPerFile))) - + (((tempOffset % (ior_param->blockSize * tasksPerFile)) - - (offsetFactor * ior_param->blockSize)) - / ior_param->transferSize); + (hints->blockSize * tasksPerFile))) + + (((tempOffset % (hints->blockSize * tasksPerFile)) + - (offsetFactor * hints->blockSize)) + / hints->transferSize); } } MPI_CHECK(MPI_File_seek(fd, tempOffset, MPI_SEEK_SET), @@ -568,14 +566,14 @@ IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testCo char *testFileName) { mpiio_options_t * test = (mpiio_options_t*) module_options; - if(test->dry_run) + if(hints->dryRun) return 0; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; MPI_File fd; MPI_Comm comm; MPI_Info mpiHints = MPI_INFO_NULL; - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { comm = MPI_COMM_SELF; } else { comm = testComm; @@ -591,7 +589,7 @@ IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t * module_options, MPI_Comm testCo if (mpiHints != MPI_INFO_NULL) MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 43c5261..35395f4 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -149,7 +149,7 @@ ior_aiori_t posix_aiori = { .xfer = POSIX_Xfer, .close = POSIX_Close, .delete = POSIX_Delete, - .init_xfer_options = aiori_posix_init_xfer_options, + .xfer_hints = aiori_posix_xfer_hints, .get_version = aiori_get_version, .fsync = POSIX_Fsync, .get_file_size = POSIX_GetFileSize, @@ -166,16 +166,14 @@ ior_aiori_t posix_aiori = { /***************************** F U N C T I O N S ******************************/ -static IOR_param_t * ior_param = NULL; +static aiori_xfer_hint_t * hints = NULL; -void aiori_posix_init_xfer_options(IOR_param_t * params){ - ior_param = params; +void aiori_posix_xfer_hints(aiori_xfer_hint_t * params){ + hints = params; } static int POSIX_check_params(aiori_mod_opt_t * param){ posix_options_t * o = (posix_options_t*) param; - if (ior_param->useExistingTestFile && o->lustre_set_striping) - ERR("Lustre stripe options are incompatible with useExistingTestFile"); if (o->beegfs_chunkSize != -1 && (!ISPOWEROFTWO(o->beegfs_chunkSize) || o->beegfs_chunkSize < (1<<16))) ERR("beegfsChunkSize must be a power of two and >64k"); if(o->lustre_stripe_count != -1 || o->lustre_stripe_size != 0) @@ -219,7 +217,7 @@ void gpfs_access_start(int fd, IOR_offset_t length, int access) take_locks.access.structLen = sizeof(take_locks.access); take_locks.access.structType = GPFS_ACCESS_RANGE; - take_locks.access.start = ior_param->offset; + take_locks.access.start = hints->offset; take_locks.access.length = length; take_locks.access.isWrite = (access == WRITE); @@ -244,7 +242,7 @@ void gpfs_access_end(int fd, IOR_offset_t length, int access) free_locks.free.structLen = sizeof(free_locks.free); free_locks.free.structType = GPFS_FREE_RANGE; - free_locks.free.start = ior_param->offset; + free_locks.free.start = hints->offset; free_locks.free.length = length; rc = gpfs_fcntl(fd, &free_locks); @@ -386,7 +384,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) set_o_direct_flag(&fd_oflag); } - if(ior_param->dryRun) + if(hints->dryRun) return (aiori_fd_t*) 0; #ifdef HAVE_LUSTRE_LUSTRE_USER_H @@ -399,7 +397,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) /* In the single-shared-file case, task 0 has to creat the file with the Lustre striping options before any other processes open the file */ - if (!ior_param->filePerProc && rank != 0) { + if (!hints->filePerProc && rank != 0) { MPI_CHECK(MPI_Barrier(testComm), "barrier error"); fd_oflag |= O_RDWR; *fd = open64(testFileName, fd_oflag, mode); @@ -436,7 +434,7 @@ aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * param) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); } - if (!ior_param->filePerProc) + if (!hints->filePerProc) MPI_CHECK(MPI_Barrier(testComm), "barrier error"); } @@ -518,7 +516,7 @@ aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) fd_oflag |= O_RDWR; - if(ior_param->dryRun) + if(hints->dryRun) return (aiori_fd_t*) 0; *fd = open64(testFileName, fd_oflag); @@ -558,7 +556,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer int fd; posix_options_t * o = (posix_options_t*) param; - if(ior_param->dryRun) + if(hints->dryRun) return length; fd = *(int *)file; @@ -571,8 +569,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer /* seek to offset */ - if (lseek64(fd, ior_param->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, ior_param->offset); + if (lseek64(fd, hints->offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, hints->offset); while (remaining > 0) { /* write/read file */ @@ -581,13 +579,13 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d writing to offset %lld\n", rank, - ior_param->offset + length - remaining); + hints->offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) ERRF("write(%d, %p, %lld) failed", fd, (void*)ptr, remaining); - if (ior_param->fsyncPerWrite == TRUE){ + if (hints->fsyncPerWrite == TRUE){ POSIX_Fsync((aiori_fd_t*) &fd, param); } } else { /* READ or CHECK */ @@ -595,7 +593,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d reading from offset %lld\n", rank, - ior_param->offset + length - remaining); + hints->offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -611,8 +609,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer rank, access == WRITE ? "write()" : "read()", rc, remaining, - ior_param->offset + length - remaining); - if (ior_param->singleXferAttempt == TRUE) + hints->offset + length - remaining); + if (hints->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); if (xferRetries > MAX_RETRY) @@ -656,7 +654,7 @@ static void POSIX_Sync(aiori_mod_opt_t * param) */ void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; if (close(*(int *)fd) != 0) ERRF("close(%d) failed", *(int *)fd); @@ -668,7 +666,7 @@ void POSIX_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) */ void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) { - if(ior_param->dryRun) + if(hints->dryRun) return; if (unlink(testFileName) != 0){ EWARNF("[RANK %03d]: unlink() of file \"%s\" failed\n", @@ -682,7 +680,7 @@ void POSIX_Delete(char *testFileName, aiori_mod_opt_t * param) IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, char *testFileName) { - if(ior_param->dryRun) + if(hints->dryRun) return 0; struct stat stat_buf; IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum; @@ -692,7 +690,7 @@ IOR_offset_t POSIX_GetFileSize(aiori_mod_opt_t * test, MPI_Comm testComm, } aggFileSizeFromStat = stat_buf.st_size; - if (ior_param->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, testComm), "cannot total data moved"); diff --git a/src/aiori.h b/src/aiori.h index 76d9f6a..bbd775d 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -24,7 +24,6 @@ #include #include -#include "ior.h" #include "iordef.h" /* IOR Definitions */ #include "option.h" @@ -63,8 +62,23 @@ typedef struct ior_aiori_statfs { uint64_t f_ffree; } ior_aiori_statfs_t; +/* + This structure contains information about the expected IO pattern that may be used to optimize data access. Optimally, it should be stored for each file descriptor, at the moment it can only be set globally per aiori backend module. + */ typedef struct aiori_xfer_hint_t{ - + int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */ + int filePerProc; /* single file or file-per-process */ + int collective; /* collective I/O */ + int numTasks; /* number of tasks for test */ + int numNodes; /* number of nodes for test */ + int randomOffset; /* access is to random offsets */ + int fsyncPerWrite; /* fsync() after each write */ + IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ + IOR_offset_t blockSize; /* contiguous bytes to write per task */ + IOR_offset_t transferSize; /* size of transfer in bytes */ + IOR_offset_t offset; /* offset for read/write */ + IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ + int singleXferAttempt; /* do not retry transfer if incomplete */ } aiori_xfer_hint_t; /* this is a dummy structure to create some type safety */ @@ -85,7 +99,7 @@ typedef struct ior_aiori { /* Allow to set generic transfer options that shall be applied to any subsequent IO call. */ - void (*init_xfer_options)(IOR_param_t * params); + void (*xfer_hints)(aiori_xfer_hint_t * params); IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, aiori_mod_opt_t *); void (*close)(aiori_fd_t *, aiori_mod_opt_t *); @@ -144,7 +158,7 @@ int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_o int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options); int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options); int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options); -void aiori_posix_init_xfer_options(IOR_param_t * params); +void aiori_posix_xfer_hints(aiori_xfer_hint_t * params); aiori_fd_t *POSIX_Create(char *testFileName, int flags, aiori_mod_opt_t * module_options); int POSIX_Mknod(char *testFileName); diff --git a/src/ior.c b/src/ior.c index 7dbf80b..32666b5 100755 --- a/src/ior.c +++ b/src/ior.c @@ -58,6 +58,27 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results, aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers); +static void ior_set_xfer_hints(IOR_param_t * p){ + aiori_xfer_hint_t * hints = & p->hints; + hints->dryRun = p->dryRun; + hints->filePerProc = p->filePerProc; + hints->collective = p->collective; + hints->numTasks = p->numTasks; + hints->numNodes = p->numNodes; + hints->randomOffset = p->randomOffset; + hints->fsyncPerWrite = p->fsyncPerWrite; + hints->segmentCount = p->segmentCount; + hints->blockSize = p->blockSize; + hints->transferSize = p->transferSize; + hints->offset = p->offset; + hints->expectedAggFileSize = p->expectedAggFileSize; + hints->singleXferAttempt = p->singleXferAttempt; + + if(backend->xfer_hints){ + backend->xfer_hints(hints); + } +} + static void test_initialize(IOR_test_t * test){ verbose = test->params.verbose; backend = test->params.backend; @@ -67,9 +88,7 @@ static void test_initialize(IOR_test_t * test){ if(backend->initialize){ backend->initialize(test->params.backend_options); } - if(backend->init_xfer_options){ - backend->init_xfer_options(& test->params); - } + ior_set_xfer_hints(& test->params); } static void test_finalize(IOR_test_t * test){ @@ -1643,9 +1662,8 @@ static void ValidateTests(IOR_param_t * test) if ((strcasecmp(test->api, "NCMPI") == 0) && test->filePerProc) ERR("file-per-proc not available in current NCMPI"); - if(test->backend->init_xfer_options){ - test->backend->init_xfer_options(test); - } + backend = test->backend; + ior_set_xfer_hints(test); /* allow the backend to validate the options */ if(test->backend->check_params){ int check = test->backend->check_params(test->backend_options); diff --git a/src/ior.h b/src/ior.h index d208507..7724dab 100755 --- a/src/ior.h +++ b/src/ior.h @@ -37,6 +37,7 @@ #endif #include "option.h" #include "iordef.h" +#include "aiori.h" #define ISPOWEROFTWO(x) ((x != 0) && !(x & (x - 1))) /******************** DATA Packet Type ***************************************/ @@ -79,8 +80,6 @@ typedef struct IO_BUFFERS * USER_GUIDE */ -struct ior_aiori; - typedef struct { const struct ior_aiori * backend; @@ -177,6 +176,8 @@ typedef struct int id; /* test's unique ID */ int intraTestBarriers; /* barriers between open/op and op/close */ + + aiori_xfer_hint_t hints; } IOR_param_t; /* each pointer for a single test */ diff --git a/src/mdtest.c b/src/mdtest.c index 3e102de..9ef91ef 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -167,8 +167,8 @@ static uid_t uid; /* Use the POSIX backend by default */ static const ior_aiori_t *backend; static void * backend_options; - -static IOR_param_t param; +static aiori_xfer_hint_t hints; +static char * api = NULL; /* This structure describes the processing status for stonewalling */ typedef struct{ @@ -376,7 +376,7 @@ static void create_file (const char *path, uint64_t itemNum) { * !collective_creates */ } else { - param.filePerProc = !shared_file; + hints.filePerProc = !shared_file; VERBOSE(3,5,"create_remove_items_helper (non-collective, shared): open..." ); aiori_fh = backend->create (curr_item, IOR_WRONLY | IOR_CREAT, backend_options); @@ -391,8 +391,8 @@ static void create_file (const char *path, uint64_t itemNum) { * According to Bill Loewe, writes are only done one time, so they are always at * offset 0 (zero). */ - param.offset = 0; - param.fsyncPerWrite = sync_file; + hints.offset = 0; + hints.fsyncPerWrite = sync_file; if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { FAIL("unable to write file %s", curr_item); } @@ -1906,9 +1906,10 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * aiori_supported_apis(APIs, APIs_legacy, MDTEST); char apiStr[1024]; sprintf(apiStr, "API for I/O [%s]", APIs); + memset(& hints, 0, sizeof(hints)); option_help options [] = { - {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & param.api}, + {'a', NULL, apiStr, OPTION_OPTIONAL_ARGUMENT, 's', & api}, {'b', NULL, "branching factor of hierarchical directory structure", OPTION_OPTIONAL_ARGUMENT, 'd', & branch_factor}, {'d', NULL, "the directory in which the tests will run", OPTION_OPTIONAL_ARGUMENT, 's', & path}, {'B', NULL, "no barriers between phases", OPTION_OPTIONAL_ARGUMENT, 'd', & no_barriers}, @@ -1953,12 +1954,13 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * }; options_all_t * global_options = airoi_create_all_module_options(options); option_parse(argc, argv, global_options); - updateParsedOptions(& param, global_options); - backend_options = param.backend_options; + backend = aiori_select(api); + if (backend == NULL) + ERR("Unrecognized I/O API"); + backend_options = airoi_update_module_options(backend, global_options); free(global_options->modules); free(global_options); - backend = param.backend; MPI_Comm_rank(testComm, &rank); MPI_Comm_size(testComm, &size); @@ -1966,8 +1968,8 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * if (backend->initialize){ backend->initialize(backend_options); } - if(backend->init_xfer_options){ - backend->init_xfer_options(& param); + if(backend->xfer_hints){ + backend->xfer_hints(& hints); } if(backend->check_params){ backend->check_params(backend_options); @@ -2011,7 +2013,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * valid_tests(); // option_print_current(options); - VERBOSE(1,-1, "api : %s", param.api); + VERBOSE(1,-1, "api : %s", api); VERBOSE(1,-1, "barriers : %s", ( barriers ? "True" : "False" )); VERBOSE(1,-1, "collective_creates : %s", ( collective_creates ? "True" : "False" )); VERBOSE(1,-1, "create_only : %s", ( create_only ? "True" : "False" )); From 8fa8ef0c02488fdb0957f555cbcbc9030aa0de26 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sun, 31 May 2020 13:30:31 +0100 Subject: [PATCH 09/11] Call backend statfs() instead of only POSIX-specific variant. --- src/aiori.c | 49 ++++++++++++----- src/ior-internal.h | 1 - src/ior-output.c | 39 +------------ src/ior.c | 12 ++-- src/ior.h | 1 - src/utilities.c | 134 +++++++++++++++++++-------------------------- src/utilities.h | 2 +- 7 files changed, 99 insertions(+), 139 deletions(-) diff --git a/src/aiori.c b/src/aiori.c index be9c2b4..f66b9bc 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -154,27 +154,48 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) */ int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options) { - int ret; + // find the parent directory + char * fileName = strdup(path); + int i; + int directoryFound = FALSE; + + /* get directory for outfile */ + i = strlen(fileName); + while (i-- > 0) { + if (fileName[i] == '/') { + fileName[i] = '\0'; + directoryFound = TRUE; + break; + } + } + /* if no directory/, use '.' */ + if (directoryFound == FALSE) { + strcpy(fileName, "."); + } + + int ret; #if defined(HAVE_STATVFS) - struct statvfs statfs_buf; + struct statvfs statfs_buf; - ret = statvfs (path, &statfs_buf); + ret = statvfs (fileName, &statfs_buf); #else - struct statfs statfs_buf; + struct statfs statfs_buf; - ret = statfs (path, &statfs_buf); + ret = statfs (fileName, &statfs_buf); #endif - if (-1 == ret) { - return -1; - } + if (-1 == ret) { + perror("POSIX couldn't call statvfs"); + return -1; + } - stat_buf->f_bsize = statfs_buf.f_bsize; - stat_buf->f_blocks = statfs_buf.f_blocks; - stat_buf->f_bfree = statfs_buf.f_bfree; - stat_buf->f_files = statfs_buf.f_files; - stat_buf->f_ffree = statfs_buf.f_ffree; + stat_buf->f_bsize = statfs_buf.f_bsize; + stat_buf->f_blocks = statfs_buf.f_blocks; + stat_buf->f_bfree = statfs_buf.f_bfree; + stat_buf->f_files = statfs_buf.f_files; + stat_buf->f_ffree = statfs_buf.f_ffree; - return 0; + free(fileName); + return 0; } int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options) diff --git a/src/ior-internal.h b/src/ior-internal.h index 9cc8406..fa7212e 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -17,7 +17,6 @@ void PrintShortSummary(IOR_test_t * test); void PrintLongSummaryAllTests(IOR_test_t *tests_head); void PrintLongSummaryHeader(); void PrintLongSummaryOneTest(IOR_test_t *test); -void DisplayFreespace(IOR_param_t * test); void GetTestFileName(char *, IOR_param_t *); void PrintRemoveTiming(double start, double finish, int rep); void PrintReducedResult(IOR_test_t *test, int access, double bw, double iops, double latency, diff --git a/src/ior-output.c b/src/ior-output.c index 2bffd40..15ffa7d 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -322,11 +322,8 @@ void ShowTestStart(IOR_param_t *test) PrintStartSection(); PrintKeyValInt("TestID", test->id); PrintKeyVal("StartTime", CurrentTimeString()); - /* if pvfs2:, then skip */ - if (strcasecmp(test->api, "DFS") && - Regex(test->testFileName, "^[a-z][a-z].*:") == 0) { - DisplayFreespace(test); - } + + ShowFileSystemSize(test); if (verbose >= VERBOSE_3 || outputFormat == OUTPUT_JSON) { char* data_packets[] = {"g","t","o","i"}; @@ -724,38 +721,6 @@ void PrintShortSummary(IOR_test_t * test) } } - -/* - * Display freespace (df). - */ -void DisplayFreespace(IOR_param_t * test) -{ - char fileName[MAX_STR] = { 0 }; - int i; - int directoryFound = FALSE; - - /* get outfile name */ - GetTestFileName(fileName, test); - - /* get directory for outfile */ - i = strlen(fileName); - while (i-- > 0) { - if (fileName[i] == '/') { - fileName[i] = '\0'; - directoryFound = TRUE; - break; - } - } - - /* if no directory/, use '.' */ - if (directoryFound == FALSE) { - strcpy(fileName, "."); - } - - ShowFileSystemSize(fileName); -} - - void PrintRemoveTiming(double start, double finish, int rep) { if (rank != 0 || verbose < VERBOSE_0) diff --git a/src/ior.c b/src/ior.c index 32666b5..46f0056 100755 --- a/src/ior.c +++ b/src/ior.c @@ -82,13 +82,14 @@ static void ior_set_xfer_hints(IOR_param_t * p){ static void test_initialize(IOR_test_t * test){ verbose = test->params.verbose; backend = test->params.backend; - if (rank == 0 && verbose >= VERBOSE_0) { - ShowTestStart(& test->params); - } if(backend->initialize){ backend->initialize(test->params.backend_options); } ior_set_xfer_hints(& test->params); + + if (rank == 0 && verbose >= VERBOSE_0) { + ShowTestStart(& test->params); + } } static void test_finalize(IOR_test_t * test){ @@ -1807,7 +1808,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset void *checkBuffer = ioBuffers->checkBuffer; void *readCheckBuffer = ioBuffers->readCheckBuffer; - test->offset = offsetArray[pairCnt]; + test->hints.offset = offsetArray[pairCnt]; // this looks inappropriate transfer = test->transferSize; if (access == WRITE) { @@ -1816,8 +1817,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset if (test->storeFileOffset == TRUE) { FillBuffer(buffer, test, test->offset, pretendRank); } - amtXferred = - backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); if (test->fsyncPerWrite) diff --git a/src/ior.h b/src/ior.h index 7724dab..9b1c464 100755 --- a/src/ior.h +++ b/src/ior.h @@ -89,7 +89,6 @@ typedef struct char * apiVersion; /* API version */ char * platform; /* platform type */ char * testFileName; /* full name for test */ - char * testFileName_fppReadCheck;/* filename for fpp read check */ char * options; /* options string */ // intermediate options int collective; /* collective I/O */ diff --git a/src/utilities.c b/src/utilities.c index 1f83c83..33b23d8 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -47,6 +47,7 @@ #include "utilities.h" #include "aiori.h" #include "ior.h" +#include "ior-internal.h" /************************** D E C L A R A T I O N S ***************************/ @@ -565,91 +566,66 @@ IOR_offset_t StringToBytes(char *size_str) /* * Displays size of file system and percent of data blocks and inodes used. */ -void ShowFileSystemSize(char *fileSystem) // this might be converted to an AIORI call +void ShowFileSystemSize(IOR_param_t * test) // this might be converted to an AIORI call { -#ifndef _WIN32 /* FIXME */ - char realPath[PATH_MAX]; - char *fileSystemUnitStr; - long long int totalFileSystemSize; - long long int freeFileSystemSize; - long long int totalInodes; - long long int freeInodes; - double totalFileSystemSizeHR; - double usedFileSystemPercentage; - double usedInodePercentage; -#ifdef __sun /* SunOS does not support statfs(), instead uses statvfs() */ - struct statvfs statusBuffer; -#else /* !__sun */ - struct statfs statusBuffer; -#endif /* __sun */ + ior_aiori_statfs_t stat; + if(! test->backend->statfs){ + WARN("Backend doesn't implement statfs"); + return; + } + char filename[MAX_PATHLEN]; + GetTestFileName(filename, test); + int ret = test->backend->statfs(filename, & stat, test->backend_options); + if( ret != 0 ){ + WARN("Backend returned error during statfs"); + return; + } + long long int totalFileSystemSize; + long long int freeFileSystemSize; + long long int totalInodes; + long long int freeInodes; + double totalFileSystemSizeHR; + double usedFileSystemPercentage; + double usedInodePercentage; + char *fileSystemUnitStr; -#ifdef __sun - if (statvfs(fileSystem, &statusBuffer) != 0) { - WARN("unable to statvfs() file system"); - return; - } -#else /* !__sun */ - if (statfs(fileSystem, &statusBuffer) != 0) { - WARN("unable to statfs() file system"); - return; - } -#endif /* __sun */ + totalFileSystemSize = stat.f_blocks * stat.f_bsize; + freeFileSystemSize = stat.f_bfree * stat.f_bsize; + usedFileSystemPercentage = (1 - ((double)freeFileSystemSize / (double)totalFileSystemSize)) * 100; + totalFileSystemSizeHR = (double)totalFileSystemSize / (double)(1<<30); - /* data blocks */ -#ifdef __sun - totalFileSystemSize = statusBuffer.f_blocks * statusBuffer.f_frsize; - freeFileSystemSize = statusBuffer.f_bfree * statusBuffer.f_frsize; -#else /* !__sun */ - totalFileSystemSize = statusBuffer.f_blocks * statusBuffer.f_bsize; - freeFileSystemSize = statusBuffer.f_bfree * statusBuffer.f_bsize; -#endif /* __sun */ + /* inodes */ + totalInodes = stat.f_files; + freeInodes = stat.f_ffree; + usedInodePercentage = (1 - ((double)freeInodes / (double)totalInodes)) * 100; - usedFileSystemPercentage = (1 - ((double)freeFileSystemSize - / (double)totalFileSystemSize)) * 100; - totalFileSystemSizeHR = - (double)totalFileSystemSize / (double)(1<<30); - fileSystemUnitStr = "GiB"; - if (totalFileSystemSizeHR > 1024) { - totalFileSystemSizeHR = (double)totalFileSystemSize / (double)((long long)1<<40); - fileSystemUnitStr = "TiB"; - } + fileSystemUnitStr = "GiB"; + if (totalFileSystemSizeHR > 1024) { + totalFileSystemSizeHR = (double)totalFileSystemSize / (double)((long long)1<<40); + fileSystemUnitStr = "TiB"; + } + if(outputFormat == OUTPUT_DEFAULT){ + fprintf(out_resultfile, "%-20s: %s\n", "Path", filename); + fprintf(out_resultfile, "%-20s: %.1f %s Used FS: %2.1f%% ", + "FS", totalFileSystemSizeHR, fileSystemUnitStr, + usedFileSystemPercentage); + fprintf(out_resultfile, "Inodes: %.1f Mi Used Inodes: %2.1f%%\n", + (double)totalInodes / (double)(1<<20), + usedInodePercentage); + fflush(out_logfile); + }else if(outputFormat == OUTPUT_JSON){ + fprintf(out_resultfile, " , \"Path\": \"%s\",", filename); + fprintf(out_resultfile, "\"Capacity\": \"%.1f %s\", \"Used Capacity\": \"%2.1f%%\",", + totalFileSystemSizeHR, fileSystemUnitStr, + usedFileSystemPercentage); + fprintf(out_resultfile, "\"Inodes\": \"%.1f Mi\", \"Used Inodes\" : \"%2.1f%%\"\n", + (double)totalInodes / (double)(1<<20), + usedInodePercentage); + }else if(outputFormat == OUTPUT_CSV){ - /* inodes */ - totalInodes = statusBuffer.f_files; - freeInodes = statusBuffer.f_ffree; - usedInodePercentage = - (1 - ((double)freeInodes / (double)totalInodes)) * 100; + } - /* show results */ - if (realpath(fileSystem, realPath) == NULL) { - WARN("unable to use realpath()"); - return; - } - - if(outputFormat == OUTPUT_DEFAULT){ - fprintf(out_resultfile, "%-20s: %s\n", "Path", realPath); - fprintf(out_resultfile, "%-20s: %.1f %s Used FS: %2.1f%% ", - "FS", totalFileSystemSizeHR, fileSystemUnitStr, - usedFileSystemPercentage); - fprintf(out_resultfile, "Inodes: %.1f Mi Used Inodes: %2.1f%%\n", - (double)totalInodes / (double)(1<<20), - usedInodePercentage); - fflush(out_logfile); - }else if(outputFormat == OUTPUT_JSON){ - fprintf(out_resultfile, " , \"Path\": \"%s\",", realPath); - fprintf(out_resultfile, "\"Capacity\": \"%.1f %s\", \"Used Capacity\": \"%2.1f%%\",", - totalFileSystemSizeHR, fileSystemUnitStr, - usedFileSystemPercentage); - fprintf(out_resultfile, "\"Inodes\": \"%.1f Mi\", \"Used Inodes\" : \"%2.1f%%\"\n", - (double)totalInodes / (double)(1<<20), - usedInodePercentage); - }else if(outputFormat == OUTPUT_CSV){ - - } - -#endif /* !_WIN32 */ - - return; + return; } /* diff --git a/src/utilities.h b/src/utilities.h index 2a9abe3..a03e17c 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -47,7 +47,7 @@ void set_o_direct_flag(int *fd); char *CurrentTimeString(void); int Regex(char *, char *); -void ShowFileSystemSize(char *); +void ShowFileSystemSize(IOR_param_t * test); void DumpBuffer(void *, size_t); void SeedRandGen(MPI_Comm); void SetHints (MPI_Info *, char *); From eb2cd27fac1f8962341dc4df63974ed5a39691df Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Wed, 10 Jun 2020 17:47:07 +0100 Subject: [PATCH 10/11] Removed offset from IOR structure. --- src/aiori-DUMMY.c | 2 +- src/aiori-HDF5.c | 8 ++++---- src/aiori-MMAP.c | 12 ++++++------ src/aiori-MPIIO.c | 12 ++++++------ src/aiori-POSIX.c | 14 +++++++------- src/aiori.h | 5 ++--- src/ior.c | 29 ++++++++++++++--------------- src/ior.h | 1 - src/mdtest.c | 5 ++--- 9 files changed, 42 insertions(+), 46 deletions(-) diff --git a/src/aiori-DUMMY.c b/src/aiori-DUMMY.c index 2e4feb5..034fc98 100755 --- a/src/aiori-DUMMY.c +++ b/src/aiori-DUMMY.c @@ -116,7 +116,7 @@ static IOR_offset_t DUMMY_GetFileSize(aiori_mod_opt_t * options, MPI_Comm testCo return 0; } -static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, aiori_mod_opt_t * options){ +static IOR_offset_t DUMMY_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * options){ if(verbose > 4){ fprintf(out_logfile, "DUMMY xfer: %p\n", file); } diff --git a/src/aiori-HDF5.c b/src/aiori-HDF5.c index cc32cbe..1e7f2bf 100755 --- a/src/aiori-HDF5.c +++ b/src/aiori-HDF5.c @@ -86,7 +86,7 @@ static void SetupDataSet(void *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *HDF5_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t HDF5_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void HDF5_Close(aiori_fd_t *, aiori_mod_opt_t *); static void HDF5_Delete(char *, aiori_mod_opt_t *); static char* HDF5_GetVersion(); @@ -417,7 +417,7 @@ static aiori_fd_t *HDF5_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * Write or read access to file using the HDF5 interface. */ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { static int firstReadCheck = FALSE, startNewDataSet; IOR_offset_t segmentPosition, segmentSize; @@ -445,7 +445,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, * hints->blockSize; segmentSize = (IOR_offset_t) (hints->numTasks) * hints->blockSize; } - if ((IOR_offset_t) ((hints->offset - segmentPosition) % segmentSize) == + if ((IOR_offset_t) ((offset - segmentPosition) % segmentSize) == 0) { /* * ordinarily start a new data set, unless this is the @@ -471,7 +471,7 @@ static IOR_offset_t HDF5_Xfer(int access, aiori_fd_t *fd, IOR_size_t * buffer, SetupDataSet(fd, access == WRITE ? IOR_CREAT : IOR_RDWR, param); } - SeekOffset(fd, hints->offset, param); + SeekOffset(fd, offset, param); /* this is necessary to reset variables for reaccessing file */ startNewDataSet = FALSE; diff --git a/src/aiori-MMAP.c b/src/aiori-MMAP.c index 453bc3a..7ed3b90 100644 --- a/src/aiori-MMAP.c +++ b/src/aiori-MMAP.c @@ -29,7 +29,7 @@ static aiori_fd_t *MMAP_Create(char *, int flags, aiori_mod_opt_t *); static aiori_fd_t *MMAP_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MMAP_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void MMAP_Close(aiori_fd_t *, aiori_mod_opt_t *); static void MMAP_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static option_help * MMAP_options(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t * init_values); @@ -156,19 +156,19 @@ static aiori_fd_t *MMAP_Open(char *testFileName, int flags, aiori_mod_opt_t * pa * Write or read access to file using mmap */ static IOR_offset_t MMAP_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { mmap_options_t *o = (mmap_options_t*) param; if (access == WRITE) { - memcpy(o->mmap_ptr + hints->offset, buffer, length); + memcpy(o->mmap_ptr + offset, buffer, length); } else { - memcpy(buffer, o->mmap_ptr + hints->offset, length); + memcpy(buffer, o->mmap_ptr + offset, length); } if (hints->fsyncPerWrite == TRUE) { - if (msync(o->mmap_ptr + hints->offset, length, MS_SYNC) != 0) + if (msync(o->mmap_ptr + offset, length, MS_SYNC) != 0) ERR("msync() failed"); - if (posix_madvise(o->mmap_ptr + hints->offset, length, + if (posix_madvise(o->mmap_ptr + offset, length, POSIX_MADV_DONTNEED) != 0) ERR("madvise() failed"); } diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index bc1b8b4..53eaad0 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -36,7 +36,7 @@ static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *); static aiori_fd_t *MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *); static aiori_fd_t *MPIIO_Open(char *, int flags, aiori_mod_opt_t *); static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *); static char* MPIIO_GetVersion(); static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *); @@ -327,7 +327,7 @@ static aiori_fd_t *MPIIO_Open(char *testFileName, int flags, aiori_mod_opt_t * m * Write or read access to file using the MPIIO interface. */ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * module_options) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * module_options) { /* NOTE: The second arg is (void *) for reads, and (const void *) for writes. Therefore, one of the two sets of assignments below @@ -386,7 +386,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer */ if (param->useFileView) { /* find offset in file */ - if (SeekOffset(mfd->fd, hints->offset, module_options) < + if (SeekOffset(mfd->fd, offset, module_options) < 0) { /* if unsuccessful */ length = -1; @@ -425,7 +425,7 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (param->useSharedFilePointer) { /* find offset in file */ if (SeekOffset - (mfd->fd, hints->offset, module_options) < 0) { + (mfd->fd, offset, module_options) < 0) { /* if unsuccessful */ length = -1; } else { @@ -444,13 +444,13 @@ static IOR_offset_t MPIIO_Xfer(int access, aiori_fd_t * fdp, IOR_size_t * buffer if (hints->collective) { /* explicit, collective call */ MPI_CHECK(Access_at_all - (mfd->fd, hints->offset, + (mfd->fd, offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, collective"); } else { /* explicit, noncollective call */ MPI_CHECK(Access_at - (mfd->fd, hints->offset, + (mfd->fd, offset, buffer, length, MPI_BYTE, &status), "cannot access explicit, noncollective"); } diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 35395f4..283a6ec 100755 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -69,7 +69,7 @@ /**************************** P R O T O T Y P E S *****************************/ static IOR_offset_t POSIX_Xfer(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *); static void POSIX_Fsync(aiori_fd_t *, aiori_mod_opt_t *); static void POSIX_Sync(aiori_mod_opt_t * ); static int POSIX_check_params(aiori_mod_opt_t * options); @@ -547,7 +547,7 @@ aiori_fd_t *POSIX_Open(char *testFileName, int flags, aiori_mod_opt_t * param) * Write or read access to file using the POSIX interface. */ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer, - IOR_offset_t length, aiori_mod_opt_t * param) + IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t * param) { int xferRetries = 0; long long remaining = (long long)length; @@ -569,8 +569,8 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer /* seek to offset */ - if (lseek64(fd, hints->offset, SEEK_SET) == -1) - ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, hints->offset); + if (lseek64(fd, offset, SEEK_SET) == -1) + ERRF("lseek64(%d, %lld, SEEK_SET) failed", fd, offset); while (remaining > 0) { /* write/read file */ @@ -579,7 +579,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d writing to offset %lld\n", rank, - hints->offset + length - remaining); + offset + length - remaining); } rc = write(fd, ptr, remaining); if (rc == -1) @@ -593,7 +593,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer fprintf(stdout, "task %d reading from offset %lld\n", rank, - hints->offset + length - remaining); + offset + length - remaining); } rc = read(fd, ptr, remaining); if (rc == 0) @@ -609,7 +609,7 @@ static IOR_offset_t POSIX_Xfer(int access, aiori_fd_t *file, IOR_size_t * buffer rank, access == WRITE ? "write()" : "read()", rc, remaining, - hints->offset + length - remaining); + offset + length - remaining); if (hints->singleXferAttempt == TRUE) MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "barrier error"); diff --git a/src/aiori.h b/src/aiori.h index bbd775d..37bc3c0 100755 --- a/src/aiori.h +++ b/src/aiori.h @@ -76,7 +76,6 @@ typedef struct aiori_xfer_hint_t{ IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ - IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ int singleXferAttempt; /* do not retry transfer if incomplete */ } aiori_xfer_hint_t; @@ -100,8 +99,8 @@ typedef struct ior_aiori { Allow to set generic transfer options that shall be applied to any subsequent IO call. */ void (*xfer_hints)(aiori_xfer_hint_t * params); - IOR_offset_t (*xfer)(int, aiori_fd_t *, IOR_size_t *, - IOR_offset_t, aiori_mod_opt_t *); + IOR_offset_t (*xfer)(int access, aiori_fd_t *, IOR_size_t *, + IOR_offset_t size, IOR_offset_t offset, aiori_mod_opt_t *); void (*close)(aiori_fd_t *, aiori_mod_opt_t *); void (*delete)(char *, aiori_mod_opt_t *); char* (*get_version)(void); diff --git a/src/ior.c b/src/ior.c index 46f0056..0199f3f 100755 --- a/src/ior.c +++ b/src/ior.c @@ -70,7 +70,6 @@ static void ior_set_xfer_hints(IOR_param_t * p){ hints->segmentCount = p->segmentCount; hints->blockSize = p->blockSize; hints->transferSize = p->transferSize; - hints->offset = p->offset; hints->expectedAggFileSize = p->expectedAggFileSize; hints->singleXferAttempt = p->singleXferAttempt; @@ -385,7 +384,7 @@ CompareBuffers(void *expectedBuffer, if (verbose >= VERBOSE_3) { fprintf(out_logfile, "[%d] At file byte offset %lld, comparing %llu-byte transfer\n", - rank, test->offset, (long long)size); + rank, (long long) offset, (long long)size); } for (i = 0; i < length; i++) { if (testbuf[i] != goodbuf[i]) { @@ -394,7 +393,7 @@ CompareBuffers(void *expectedBuffer, fprintf(out_logfile, "[%d] At transfer buffer #%lld, index #%lld (file byte offset %lld):\n", rank, transferCount - 1, (long long)i, - test->offset + + (long long) offset + (IOR_size_t) (i * sizeof(IOR_size_t))); fprintf(out_logfile, "[%d] %s0x", rank, bufferLabel1); fprintf(out_logfile, "%016llx\n", goodbuf[i]); @@ -410,10 +409,10 @@ CompareBuffers(void *expectedBuffer, } } else if (verbose >= VERBOSE_5 && i % 4 == 0) { fprintf(out_logfile, - "[%d] PASSED offset = %lld bytes, transfer %lld\n", + "[%d] PASSED offset = %lu bytes, transfer %lld\n", rank, ((i * sizeof(unsigned long long)) + - test->offset), transferCount); + offset), transferCount); fprintf(out_logfile, "[%d] GOOD %s0x", rank, bufferLabel1); for (j = 0; j < 4; j++) fprintf(out_logfile, "%016llx ", goodbuf[i + j]); @@ -436,8 +435,8 @@ CompareBuffers(void *expectedBuffer, "%lld errors between buffer indices %lld and %lld.\n", (long long)errorCount, (long long)first, (long long)last); - fprintf(out_logfile, "[%d] File byte offset = %lld:\n", rank, - ((first * sizeof(unsigned long long)) + test->offset)); + fprintf(out_logfile, "[%d] File byte offset = %lu:\n", rank, + ((first * sizeof(unsigned long long)) + offset)); fprintf(out_logfile, "[%d] %s0x", rank, bufferLabel1); for (j = first; j < length && j < first + 4; j++) @@ -1808,16 +1807,16 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset void *checkBuffer = ioBuffers->checkBuffer; void *readCheckBuffer = ioBuffers->readCheckBuffer; - test->hints.offset = offsetArray[pairCnt]; // this looks inappropriate + IOR_offset_t offset = offsetArray[pairCnt]; // this looks inappropriate transfer = test->transferSize; if (access == WRITE) { /* fills each transfer with a unique pattern * containing the offset into the file */ if (test->storeFileOffset == TRUE) { - FillBuffer(buffer, test, test->offset, pretendRank); + FillBuffer(buffer, test, offset, pretendRank); } - amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot write to file"); if (test->fsyncPerWrite) @@ -1827,7 +1826,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset nanosleep( & wait, NULL); } } else if (access == READ) { - amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, buffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file"); if (test->interIODelay > 0){ @@ -1838,10 +1837,10 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset memset(checkBuffer, 'a', transfer); if (test->storeFileOffset == TRUE) { - FillBuffer(readCheckBuffer, test, test->offset, pretendRank); + FillBuffer(readCheckBuffer, test, offset, pretendRank); } - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, offset, test->backend_options); if (amtXferred != transfer) ERR("cannot read from file write check"); (*transferCount)++; @@ -1851,12 +1850,12 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset } else if (access == READCHECK) { memset(checkBuffer, 'a', transfer); - amtXferred = backend->xfer(access, fd, checkBuffer, transfer, test->backend_options); + amtXferred = backend->xfer(access, fd, checkBuffer, transfer, offset, test->backend_options); if (amtXferred != transfer){ ERR("cannot read from file"); } if (test->storeFileOffset == TRUE) { - FillBuffer(readCheckBuffer, test, test->offset, pretendRank); + FillBuffer(readCheckBuffer, test, offset, pretendRank); } *errors += CompareBuffers(readCheckBuffer, checkBuffer, transfer, *transferCount, test, READCHECK); } diff --git a/src/ior.h b/src/ior.h index 9b1c464..202fffb 100755 --- a/src/ior.h +++ b/src/ior.h @@ -120,7 +120,6 @@ typedef struct IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */ IOR_offset_t blockSize; /* contiguous bytes to write per task */ IOR_offset_t transferSize; /* size of transfer in bytes */ - IOR_offset_t offset; /* offset for read/write */ IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */ int summary_every_test; /* flag to print summary every test, not just at end */ diff --git a/src/mdtest.c b/src/mdtest.c index 9ef91ef..3152f33 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -391,9 +391,8 @@ static void create_file (const char *path, uint64_t itemNum) { * According to Bill Loewe, writes are only done one time, so they are always at * offset 0 (zero). */ - hints.offset = 0; hints.fsyncPerWrite = sync_file; - if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, backend_options)) { + if ( write_bytes != (size_t) backend->xfer (WRITE, aiori_fh, (IOR_size_t *) write_buffer, write_bytes, 0, backend_options)) { FAIL("unable to write file %s", curr_item); } } @@ -716,7 +715,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) { /* read file */ if (read_bytes > 0) { read_buffer[0] = 42; /* use a random value to ensure that the read_buffer is now different from the expected buffer and read isn't sometimes NOOP */ - if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, backend_options)) { + if (read_bytes != (size_t) backend->xfer (READ, aiori_fh, (IOR_size_t *) read_buffer, read_bytes, 0, backend_options)) { FAIL("unable to read file %s", item); } if(verify_read){ From e08314f571e30766136cf9b18d4ccc2a15850bd1 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 11 Jun 2020 17:26:58 +0000 Subject: [PATCH 11/11] update DFS and DAOS drivers to new aiori module interface. Signed-off-by: Mohamad Chaarawi --- src/aiori-DAOS.c | 200 ++++++++++++++++++++++----------------- src/aiori-DFS.c | 242 ++++++++++++++++++++++++++--------------------- 2 files changed, 248 insertions(+), 194 deletions(-) diff --git a/src/aiori-DAOS.c b/src/aiori-DAOS.c index 7f07f7c..c453b2e 100644 --- a/src/aiori-DAOS.c +++ b/src/aiori-DAOS.c @@ -24,15 +24,16 @@ #include #include +#include #include #include -#include "ior.h" #include "aiori.h" +#include "utilities.h" #include "iordef.h" /************************** O P T I O N S *****************************/ -struct daos_options{ +typedef struct { char *pool; char *svcl; char *group; @@ -40,49 +41,62 @@ struct daos_options{ int chunk_size; int destroy; char *oclass; -}; +} DAOS_options_t; -static struct daos_options o = { - .pool = NULL, - .svcl = NULL, - .group = NULL, - .cont = NULL, - .chunk_size = 1048576, - .destroy = 0, - .oclass = NULL, -}; +static option_help * DAOS_options(aiori_mod_opt_t ** init_backend_options, + aiori_mod_opt_t * init_values){ + DAOS_options_t * o = malloc(sizeof(DAOS_options_t)); -static option_help options [] = { - {0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.pool}, - {0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o.svcl}, - {0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o.group}, - {0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o.cont}, - {0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, - {0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o.destroy}, - {0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, - LAST_OPTION -}; + if (init_values != NULL) { + memcpy(o, init_values, sizeof(DAOS_options_t)); + } else { + memset(o, 0, sizeof(DAOS_options_t)); + /* initialize the options properly */ + o->chunk_size = 1048576; + } + + *init_backend_options = (aiori_mod_opt_t *) o; + + option_help h [] = { + {0, "daos.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool}, + {0, "daos.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl}, + {0, "daos.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group}, + {0, "daos.cont", "container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont}, + {0, "daos.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size}, + {0, "daos.destroy", "Destroy Container", OPTION_FLAG, 'd', &o->destroy}, + {0, "daos.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass}, + LAST_OPTION + }; + + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} /**************************** P R O T O T Y P E S *****************************/ -static void DAOS_Init(); -static void DAOS_Fini(); -static void *DAOS_Create(char *, IOR_param_t *); -static void *DAOS_Open(char *, IOR_param_t *); -static int DAOS_Access(const char *, int, IOR_param_t *); -static IOR_offset_t DAOS_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void DAOS_Close(void *, IOR_param_t *); -static void DAOS_Delete(char *, IOR_param_t *); +static void DAOS_Init(aiori_mod_opt_t *); +static void DAOS_Fini(aiori_mod_opt_t *); +static aiori_fd_t *DAOS_Create(char *, int, aiori_mod_opt_t *); +static aiori_fd_t *DAOS_Open(char *, int, aiori_mod_opt_t *); +static int DAOS_Access(const char *, int, aiori_mod_opt_t *); +static IOR_offset_t DAOS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, + IOR_offset_t, aiori_mod_opt_t *); +static void DAOS_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void DAOS_Delete(char *, aiori_mod_opt_t *); static char* DAOS_GetVersion(); -static void DAOS_Fsync(void *, IOR_param_t *); -static IOR_offset_t DAOS_GetFileSize(IOR_param_t *, MPI_Comm, char *); +static void DAOS_Fsync(aiori_fd_t *, aiori_mod_opt_t *); +static IOR_offset_t DAOS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); static option_help * DAOS_options(); +static void DAOS_init_xfer_options(aiori_xfer_hint_t *); +static int DAOS_check_params(aiori_mod_opt_t *); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t daos_aiori = { .name = "DAOS", + .initialize = DAOS_Init, + .finalize = DAOS_Fini, .create = DAOS_Create, .open = DAOS_Open, .access = DAOS_Access, @@ -90,15 +104,17 @@ ior_aiori_t daos_aiori = { .close = DAOS_Close, .delete = DAOS_Delete, .get_version = DAOS_GetVersion, + .xfer_hints = DAOS_init_xfer_options, .fsync = DAOS_Fsync, .get_file_size = DAOS_GetFileSize, - .initialize = DAOS_Init, - .finalize = DAOS_Fini, - .get_options = DAOS_options, .statfs = aiori_posix_statfs, .mkdir = aiori_posix_mkdir, .rmdir = aiori_posix_rmdir, .stat = aiori_posix_stat, + .get_options = DAOS_options, + .xfer_hints = DAOS_init_xfer_options, + .check_params = DAOS_check_params, + .enable_mdtest = false, }; #define IOR_DAOS_MUR_SEED 0xDEAD10CC @@ -144,6 +160,22 @@ do { \ MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \ } while (0) +static aiori_xfer_hint_t * hints = NULL; + +void DAOS_init_xfer_options(aiori_xfer_hint_t * params) +{ + hints = params; +} + +static int DAOS_check_params(aiori_mod_opt_t * options){ + DAOS_options_t *o = (DAOS_options_t *) options; + + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) + ERR("Invalid pool or container options\n"); + + return 0; +} + /* Distribute process 0's pool or container handle to others. */ static void HandleDistribute(daos_handle_t *handle, enum handleType type) @@ -202,29 +234,24 @@ HandleDistribute(daos_handle_t *handle, enum handleType type) free(global.iov_buf); } -static option_help * -DAOS_options() -{ - return options; -} - static void -DAOS_Init() +DAOS_Init(aiori_mod_opt_t * options) { + DAOS_options_t *o = (DAOS_options_t *)options; int rc; if (daos_initialized) return; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) { + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) { GERR("Invalid DAOS pool/cont\n"); return; } - if (o.oclass) { - objectClass = daos_oclass_name2id(o.oclass); + if (o->oclass) { + objectClass = daos_oclass_name2id(o->oclass); if (objectClass == OC_UNKNOWN) - GERR("Invalid DAOS Object class %s\n", o.oclass); + GERR("Invalid DAOS Object class %s\n", o->oclass); } rc = daos_init(); @@ -237,25 +264,25 @@ DAOS_Init() static daos_pool_info_t po_info; static daos_cont_info_t co_info; - INFO(VERBOSE_1, "Connecting to pool %s", o.pool); + INFO(VERBOSE_1, "Connecting to pool %s", o->pool); - rc = uuid_parse(o.pool, uuid); - DCHECK(rc, "Failed to parse 'pool': %s", o.pool); + rc = uuid_parse(o->pool, uuid); + DCHECK(rc, "Failed to parse 'pool': %s", o->pool); - svcl = daos_rank_list_parse(o.svcl, ":"); + svcl = daos_rank_list_parse(o->svcl, ":"); if (svcl == NULL) ERR("Failed to allocate svcl"); - rc = daos_pool_connect(uuid, o.group, svcl, DAOS_PC_RW, + rc = daos_pool_connect(uuid, o->group, svcl, DAOS_PC_RW, &poh, &po_info, NULL); d_rank_list_free(svcl); - DCHECK(rc, "Failed to connect to pool %s", o.pool); + DCHECK(rc, "Failed to connect to pool %s", o->pool); - INFO(VERBOSE_1, "Create/Open Container %s", o.cont); + INFO(VERBOSE_1, "Create/Open Container %s", o->cont); uuid_clear(uuid); - rc = uuid_parse(o.cont, uuid); - DCHECK(rc, "Failed to parse 'cont': %s", o.cont); + rc = uuid_parse(o->cont, uuid); + DCHECK(rc, "Failed to parse 'cont': %s", o->cont); rc = daos_cont_open(poh, uuid, DAOS_COO_RW, &coh, &co_info, NULL); @@ -278,8 +305,9 @@ DAOS_Init() } static void -DAOS_Fini() +DAOS_Fini(aiori_mod_opt_t *options) { + DAOS_options_t *o = (DAOS_options_t *)options; int rc; if (!daos_initialized) @@ -288,18 +316,18 @@ DAOS_Fini() MPI_Barrier(MPI_COMM_WORLD); rc = daos_cont_close(coh, NULL); if (rc) { - DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } MPI_Barrier(MPI_COMM_WORLD); - if (o.destroy) { + if (o->destroy) { if (rank == 0) { uuid_t uuid; double t1, t2; - INFO(VERBOSE_1, "Destroying DAOS Container %s", o.cont); - uuid_parse(o.cont, uuid); + INFO(VERBOSE_1, "Destroying DAOS Container %s", o->cont); + uuid_parse(o->cont, uuid); t1 = MPI_Wtime(); rc = daos_cont_destroy(poh, uuid, 1, NULL); t2 = MPI_Wtime(); @@ -310,7 +338,7 @@ DAOS_Fini() MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD); if (rc) { if (rank == 0) - DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } } @@ -319,7 +347,7 @@ DAOS_Fini() INFO(VERBOSE_1, "Disconnecting from DAOS POOL.."); rc = daos_pool_disconnect(poh, NULL); - DCHECK(rc, "Failed to disconnect from pool %s", o.pool); + DCHECK(rc, "Failed to disconnect from pool %s", o->pool); MPI_CHECK(MPI_Barrier(MPI_COMM_WORLD), "barrier error"); if (rank == 0) @@ -334,38 +362,38 @@ DAOS_Fini() static void gen_oid(const char *name, daos_obj_id_t *oid) { - oid->lo = d_hash_murmur64(name, strlen(name), IOR_DAOS_MUR_SEED); oid->hi = 0; daos_array_generate_id(oid, objectClass, true, 0); } -static void * -DAOS_Create(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DAOS_Create(char *testFileName, int flags, aiori_mod_opt_t *param) { + DAOS_options_t *o = (DAOS_options_t*) param; daos_obj_id_t oid; int rc; /** Convert file name into object ID */ gen_oid(testFileName, &oid); - + /** Create the array */ - if (param->filePerProc || rank == 0) { - rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o.chunk_size, + if (hints->filePerProc || rank == 0) { + rc = daos_array_create(coh, oid, DAOS_TX_NONE, 1, o->chunk_size, &aoh, NULL); DCHECK(rc, "Failed to create array object\n"); } /** Distribute the array handle if not FPP */ - if (!param->filePerProc) + if (!hints->filePerProc) HandleDistribute(&aoh, ARRAY_HANDLE); - return &aoh; + return (aiori_fd_t*)(&aoh); } static int -DAOS_Access(const char *testFileName, int mode, IOR_param_t * param) +DAOS_Access(const char *testFileName, int mode, aiori_mod_opt_t * param) { daos_obj_id_t oid; daos_size_t cell_size, chunk_size; @@ -387,8 +415,8 @@ DAOS_Access(const char *testFileName, int mode, IOR_param_t * param) return rc; } -static void * -DAOS_Open(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DAOS_Open(char *testFileName, int flags, aiori_mod_opt_t *param) { daos_obj_id_t oid; @@ -396,7 +424,7 @@ DAOS_Open(char *testFileName, IOR_param_t *param) gen_oid(testFileName, &oid); /** Open the array */ - if (param->filePerProc || rank == 0) { + if (hints->filePerProc || rank == 0) { daos_size_t cell_size, chunk_size; int rc; @@ -409,15 +437,15 @@ DAOS_Open(char *testFileName, IOR_param_t *param) } /** Distribute the array handle if not FPP */ - if (!param->filePerProc) + if (!hints->filePerProc) HandleDistribute(&aoh, ARRAY_HANDLE); - return &aoh; + return (aiori_fd_t*)(&aoh); } static IOR_offset_t -DAOS_Xfer(int access, void *file, IOR_size_t *buffer, - IOR_offset_t length, IOR_param_t *param) +DAOS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length, + IOR_offset_t off, aiori_mod_opt_t *param) { daos_array_iod_t iod; daos_range_t rg; @@ -428,7 +456,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer, /** set array location */ iod.arr_nr = 1; rg.rg_len = length; - rg.rg_idx = param->offset; + rg.rg_idx = off; iod.arr_rgs = &rg; /** set memory location */ @@ -448,7 +476,7 @@ DAOS_Xfer(int access, void *file, IOR_size_t *buffer, } static void -DAOS_Close(void *file, IOR_param_t *param) +DAOS_Close(aiori_fd_t *file, aiori_mod_opt_t *param) { int rc; @@ -462,7 +490,7 @@ DAOS_Close(void *file, IOR_param_t *param) } static void -DAOS_Delete(char *testFileName, IOR_param_t *param) +DAOS_Delete(char *testFileName, aiori_mod_opt_t *param) { daos_obj_id_t oid; daos_size_t cell_size, chunk_size; @@ -500,13 +528,13 @@ DAOS_GetVersion() } static void -DAOS_Fsync(void *file, IOR_param_t *param) +DAOS_Fsync(aiori_fd_t *file, aiori_mod_opt_t *param) { return; } static IOR_offset_t -DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) +DAOS_GetFileSize(aiori_mod_opt_t *param, MPI_Comm comm, char *testFileName) { daos_obj_id_t oid; daos_size_t size; @@ -519,7 +547,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) gen_oid(testFileName, &oid); /** open the array to verify it exists */ - if (param->filePerProc || rank == 0) { + if (hints->filePerProc || rank == 0) { daos_size_t cell_size, chunk_size; rc = daos_array_open(coh, oid, DAOS_TX_NONE, DAOS_OO_RO, @@ -537,7 +565,7 @@ DAOS_GetFileSize(IOR_param_t *param, MPI_Comm testComm, char *testFileName) aoh.cookie = 0; } - if (!param->filePerProc) + if (!hints->filePerProc) MPI_Bcast(&size, 1, MPI_LONG, 0, MPI_COMM_WORLD); return size; diff --git a/src/aiori-DFS.c b/src/aiori-DFS.c index 6487488..7f8ab7a 100755 --- a/src/aiori-DFS.c +++ b/src/aiori-DFS.c @@ -27,15 +27,15 @@ #include #include +#include #include #include #include #include -#include "ior.h" -#include "iordef.h" #include "aiori.h" #include "utilities.h" +#include "iordef.h" dfs_t *dfs; static daos_handle_t poh, coh; @@ -56,7 +56,7 @@ enum handleType { }; /************************** O P T I O N S *****************************/ -struct dfs_options{ +typedef struct { char *pool; char *svcl; char *group; @@ -66,57 +66,69 @@ struct dfs_options{ char *dir_oclass; char *prefix; int destroy; -}; +} DFS_options_t; -static struct dfs_options o = { - .pool = NULL, - .svcl = NULL, - .group = NULL, - .cont = NULL, - .chunk_size = 1048576, - .oclass = NULL, - .dir_oclass = NULL, - .prefix = NULL, - .destroy = 0, -}; +static option_help * DFS_options(aiori_mod_opt_t ** init_backend_options, + aiori_mod_opt_t * init_values){ + DFS_options_t * o = malloc(sizeof(DFS_options_t)); -static option_help options [] = { - {0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.pool}, - {0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', & o.svcl}, - {0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', & o.group}, - {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', & o.cont}, - {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o.chunk_size}, - {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.oclass}, - {0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', &o.dir_oclass}, - {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', & o.prefix}, - {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o.destroy}, - LAST_OPTION -}; + if (init_values != NULL) { + memcpy(o, init_values, sizeof(DFS_options_t)); + } else { + memset(o, 0, sizeof(DFS_options_t)); + /* initialize the options properly */ + o->chunk_size = 1048576; + } + + *init_backend_options = (aiori_mod_opt_t *) o; + + option_help h [] = { + {0, "dfs.pool", "pool uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->pool}, + {0, "dfs.svcl", "pool SVCL", OPTION_OPTIONAL_ARGUMENT, 's', &o->svcl}, + {0, "dfs.group", "server group", OPTION_OPTIONAL_ARGUMENT, 's', &o->group}, + {0, "dfs.cont", "DFS container uuid", OPTION_OPTIONAL_ARGUMENT, 's', &o->cont}, + {0, "dfs.chunk_size", "chunk size", OPTION_OPTIONAL_ARGUMENT, 'd', &o->chunk_size}, + {0, "dfs.oclass", "object class", OPTION_OPTIONAL_ARGUMENT, 's', &o->oclass}, + {0, "dfs.dir_oclass", "directory object class", OPTION_OPTIONAL_ARGUMENT, 's', + &o->dir_oclass}, + {0, "dfs.prefix", "mount prefix", OPTION_OPTIONAL_ARGUMENT, 's', &o->prefix}, + {0, "dfs.destroy", "Destroy DFS Container", OPTION_FLAG, 'd', &o->destroy}, + LAST_OPTION + }; + + option_help * help = malloc(sizeof(h)); + memcpy(help, h, sizeof(h)); + return help; +} /**************************** P R O T O T Y P E S *****************************/ -static void *DFS_Create(char *, IOR_param_t *); -static void *DFS_Open(char *, IOR_param_t *); -static IOR_offset_t DFS_Xfer(int, void *, IOR_size_t *, - IOR_offset_t, IOR_param_t *); -static void DFS_Close(void *, IOR_param_t *); -static void DFS_Delete(char *, IOR_param_t *); +static void DFS_Init(aiori_mod_opt_t *); +static void DFS_Finalize(aiori_mod_opt_t *); +static aiori_fd_t *DFS_Create(char *, int, aiori_mod_opt_t *); +static aiori_fd_t *DFS_Open(char *, int, aiori_mod_opt_t *); +static IOR_offset_t DFS_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, + IOR_offset_t, aiori_mod_opt_t *); +static void DFS_Close(aiori_fd_t *, aiori_mod_opt_t *); +static void DFS_Delete(char *, aiori_mod_opt_t *); static char* DFS_GetVersion(); -static void DFS_Fsync(void *, IOR_param_t *); -static void DFS_Sync(IOR_param_t *); -static IOR_offset_t DFS_GetFileSize(IOR_param_t *, MPI_Comm, char *); -static int DFS_Statfs (const char *, ior_aiori_statfs_t *, IOR_param_t *); -static int DFS_Stat (const char *, struct stat *, IOR_param_t *); -static int DFS_Mkdir (const char *, mode_t, IOR_param_t *); -static int DFS_Rmdir (const char *, IOR_param_t *); -static int DFS_Access (const char *, int, IOR_param_t *); -static void DFS_Init(); -static void DFS_Finalize(); +static void DFS_Fsync(aiori_fd_t *, aiori_mod_opt_t *); +static void DFS_Sync(aiori_mod_opt_t *); +static IOR_offset_t DFS_GetFileSize(aiori_mod_opt_t *, MPI_Comm, char *); +static int DFS_Statfs (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *); +static int DFS_Stat (const char *, struct stat *, aiori_mod_opt_t *); +static int DFS_Mkdir (const char *, mode_t, aiori_mod_opt_t *); +static int DFS_Rmdir (const char *, aiori_mod_opt_t *); +static int DFS_Access (const char *, int, aiori_mod_opt_t *); static option_help * DFS_options(); +static void DFS_init_xfer_options(aiori_xfer_hint_t *); +static int DFS_check_params(aiori_mod_opt_t *); /************************** D E C L A R A T I O N S ***************************/ ior_aiori_t dfs_aiori = { .name = "DFS", + .initialize = DFS_Init, + .finalize = DFS_Finalize, .create = DFS_Create, .open = DFS_Open, .xfer = DFS_Xfer, @@ -126,14 +138,14 @@ ior_aiori_t dfs_aiori = { .fsync = DFS_Fsync, .sync = DFS_Sync, .get_file_size = DFS_GetFileSize, + .xfer_hints = DFS_init_xfer_options, .statfs = DFS_Statfs, .mkdir = DFS_Mkdir, .rmdir = DFS_Rmdir, .access = DFS_Access, .stat = DFS_Stat, - .initialize = DFS_Init, - .finalize = DFS_Finalize, .get_options = DFS_options, + .check_params = DFS_check_params, .enable_mdtest = true, }; @@ -165,6 +177,22 @@ do { \ MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \ } while (0) +static aiori_xfer_hint_t * hints = NULL; + +void DFS_init_xfer_options(aiori_xfer_hint_t * params) +{ + hints = params; +} + +static int DFS_check_params(aiori_mod_opt_t * options){ + DFS_options_t *o = (DFS_options_t *) options; + + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) + ERR("Invalid pool or container options\n"); + + return 0; +} + static inline struct aiori_dir_hdl * hdl_obj(d_list_t *rlink) { @@ -378,27 +406,25 @@ lookup_insert_dir(const char *name, mode_t *mode) return hdl->oh; } -static option_help * DFS_options(){ - return options; -} - static void -DFS_Init() { +DFS_Init(aiori_mod_opt_t * options) +{ + DFS_options_t *o = (DFS_options_t *)options; int rc; - if (o.pool == NULL || o.svcl == NULL || o.cont == NULL) + if (o->pool == NULL || o->svcl == NULL || o->cont == NULL) ERR("Invalid pool or container options\n"); - if (o.oclass) { - objectClass = daos_oclass_name2id(o.oclass); + if (o->oclass) { + objectClass = daos_oclass_name2id(o->oclass); if (objectClass == OC_UNKNOWN) - GERR("Invalid DAOS object class %s\n", o.oclass); + GERR("Invalid DAOS object class %s\n", o->oclass); } - if (o.dir_oclass) { - dir_oclass = daos_oclass_name2id(o.dir_oclass); + if (o->dir_oclass) { + dir_oclass = daos_oclass_name2id(o->dir_oclass); if (dir_oclass == OC_UNKNOWN) - GERR("Invalid DAOS directory object class %s\n", o.dir_oclass); + GERR("Invalid DAOS directory object class %s\n", o->dir_oclass); } rc = daos_init(); @@ -413,21 +439,21 @@ DFS_Init() { daos_pool_info_t pool_info; daos_cont_info_t co_info; - rc = uuid_parse(o.pool, pool_uuid); - DCHECK(rc, "Failed to parse 'Pool uuid': %s", o.pool); + rc = uuid_parse(o->pool, pool_uuid); + DCHECK(rc, "Failed to parse 'Pool uuid': %s", o->pool); - rc = uuid_parse(o.cont, co_uuid); - DCHECK(rc, "Failed to parse 'Cont uuid': %s", o.cont); + rc = uuid_parse(o->cont, co_uuid); + DCHECK(rc, "Failed to parse 'Cont uuid': %s", o->cont); - svcl = daos_rank_list_parse(o.svcl, ":"); + svcl = daos_rank_list_parse(o->svcl, ":"); if (svcl == NULL) ERR("Failed to allocate svcl"); - INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o.pool, o.svcl); - INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o.cont); + INFO(VERBOSE_1, "Pool uuid = %s, SVCL = %s\n", o->pool, o->svcl); + INFO(VERBOSE_1, "DFS Container namespace uuid = %s\n", o->cont); /** Connect to DAOS pool */ - rc = daos_pool_connect(pool_uuid, o.group, svcl, DAOS_PC_RW, + rc = daos_pool_connect(pool_uuid, o->group, svcl, DAOS_PC_RW, &poh, &pool_info, NULL); d_rank_list_free(svcl); DCHECK(rc, "Failed to connect to pool"); @@ -453,15 +479,16 @@ DFS_Init() { HandleDistribute(CONT_HANDLE); HandleDistribute(DFS_HANDLE); - if (o.prefix) { - rc = dfs_set_prefix(dfs, o.prefix); + if (o->prefix) { + rc = dfs_set_prefix(dfs, o->prefix); DCHECK(rc, "Failed to set DFS Prefix"); } } static void -DFS_Finalize() +DFS_Finalize(aiori_mod_opt_t *options) { + DFS_options_t *o = (DFS_options_t *)options; int rc; MPI_Barrier(MPI_COMM_WORLD); @@ -472,16 +499,16 @@ DFS_Finalize() MPI_Barrier(MPI_COMM_WORLD); rc = daos_cont_close(coh, NULL); - DCHECK(rc, "Failed to close container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to close container %s (%d)", o->cont, rc); MPI_Barrier(MPI_COMM_WORLD); - if (o.destroy) { + if (o->destroy) { if (rank == 0) { uuid_t uuid; double t1, t2; - INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o.cont); - uuid_parse(o.cont, uuid); + INFO(VERBOSE_1, "Destorying DFS Container: %s\n", o->cont); + uuid_parse(o->cont, uuid); t1 = MPI_Wtime(); rc = daos_cont_destroy(poh, uuid, 1, NULL); t2 = MPI_Wtime(); @@ -492,7 +519,7 @@ DFS_Finalize() MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD); if (rc) { if (rank == 0) - DCHECK(rc, "Failed to destroy container %s (%d)", o.cont, rc); + DCHECK(rc, "Failed to destroy container %s (%d)", o->cont, rc); MPI_Abort(MPI_COMM_WORLD, -1); } } @@ -515,17 +542,16 @@ DFS_Finalize() /* * Creat and open a file through the DFS interface. */ -static void * -DFS_Create(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DFS_Create(char *testFileName, int flags, aiori_mod_opt_t *param) { + DFS_options_t *o = (DFS_options_t*) param; char *name = NULL, *dir_name = NULL; dfs_obj_t *obj = NULL, *parent = NULL; - mode_t mode = 0644; + mode_t mode = 0664; int fd_oflag = 0; int rc; - assert(param); - rc = parse_filename(testFileName, &name, &dir_name); DCHECK(rc, "Failed to parse path %s", testFileName); assert(dir_name); @@ -535,20 +561,20 @@ DFS_Create(char *testFileName, IOR_param_t *param) if (parent == NULL) GERR("Failed to lookup parent dir"); - mode = S_IFREG | param->mode; - if (param->filePerProc || rank == 0) { + mode = S_IFREG | mode; + if (hints->filePerProc || rank == 0) { fd_oflag |= O_CREAT | O_RDWR | O_EXCL; rc = dfs_open(dfs, parent, name, mode, fd_oflag, - objectClass, o.chunk_size, NULL, &obj); + objectClass, o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); } - if (!param->filePerProc) { + if (!hints->filePerProc) { MPI_Barrier(MPI_COMM_WORLD); if (rank != 0) { fd_oflag |= O_RDWR; rc = dfs_open(dfs, parent, name, mode, fd_oflag, - objectClass, o.chunk_size, NULL, &obj); + objectClass, o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); } } @@ -558,27 +584,27 @@ DFS_Create(char *testFileName, IOR_param_t *param) if (dir_name) free(dir_name); - return ((void *)obj); + return (aiori_fd_t *)(obj); } /* * Open a file through the DFS interface. */ -static void * -DFS_Open(char *testFileName, IOR_param_t *param) +static aiori_fd_t * +DFS_Open(char *testFileName, int flags, aiori_mod_opt_t *param) { + DFS_options_t *o = (DFS_options_t*) param; char *name = NULL, *dir_name = NULL; dfs_obj_t *obj = NULL, *parent = NULL; - mode_t mode; - int rc; + mode_t mode = 0664; int fd_oflag = 0; + int rc; fd_oflag |= O_RDWR; - mode = S_IFREG | param->mode; + mode = S_IFREG | flags; rc = parse_filename(testFileName, &name, &dir_name); DCHECK(rc, "Failed to parse path %s", testFileName); - assert(dir_name); assert(name); @@ -587,7 +613,7 @@ DFS_Open(char *testFileName, IOR_param_t *param) GERR("Failed to lookup parent dir"); rc = dfs_open(dfs, parent, name, mode, fd_oflag, objectClass, - o.chunk_size, NULL, &obj); + o->chunk_size, NULL, &obj); DCHECK(rc, "dfs_open() of %s Failed", name); if (name) @@ -595,15 +621,15 @@ DFS_Open(char *testFileName, IOR_param_t *param) if (dir_name) free(dir_name); - return ((void *)obj); + return (aiori_fd_t *)(obj); } /* * Write or read access to file using the DFS interface. */ static IOR_offset_t -DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, - IOR_param_t *param) +DFS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length, + IOR_offset_t off, aiori_mod_opt_t *param) { int xferRetries = 0; long long remaining = (long long)length; @@ -626,20 +652,20 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, /* write/read file */ if (access == WRITE) { - rc = dfs_write(dfs, obj, &sgl, param->offset, NULL); + rc = dfs_write(dfs, obj, &sgl, off, NULL); if (rc) { fprintf(stderr, "dfs_write() failed (%d)", rc); return -1; } ret = remaining; } else { - rc = dfs_read(dfs, obj, &sgl, param->offset, &ret, NULL); + rc = dfs_read(dfs, obj, &sgl, off, &ret, NULL); if (rc || ret == 0) fprintf(stderr, "dfs_read() failed(%d)", rc); } if (ret < remaining) { - if (param->singleXferAttempt == TRUE) + if (hints->singleXferAttempt == TRUE) exit(-1); if (xferRetries > MAX_RETRY) ERR("too many retries -- aborting"); @@ -659,7 +685,7 @@ DFS_Xfer(int access, void *file, IOR_size_t *buffer, IOR_offset_t length, * Perform fsync(). */ static void -DFS_Fsync(void *fd, IOR_param_t * param) +DFS_Fsync(aiori_fd_t *fd, aiori_mod_opt_t * param) { /* no cache in DFS, so this is a no-op currently */ dfs_sync(dfs); @@ -670,7 +696,7 @@ DFS_Fsync(void *fd, IOR_param_t * param) * Perform sync() on the dfs mount. */ static void -DFS_Sync(IOR_param_t * param) +DFS_Sync(aiori_mod_opt_t * param) { /* no cache in DFS, so this is a no-op currently */ dfs_sync(dfs); @@ -681,7 +707,7 @@ DFS_Sync(IOR_param_t * param) * Close a file through the DFS interface. */ static void -DFS_Close(void *fd, IOR_param_t * param) +DFS_Close(aiori_fd_t *fd, aiori_mod_opt_t * param) { dfs_release((dfs_obj_t *)fd); } @@ -690,7 +716,7 @@ DFS_Close(void *fd, IOR_param_t * param) * Delete a file through the DFS interface. */ static void -DFS_Delete(char *testFileName, IOR_param_t * param) +DFS_Delete(char *testFileName, aiori_mod_opt_t * param) { char *name = NULL, *dir_name = NULL; dfs_obj_t *parent = NULL; @@ -727,7 +753,7 @@ static char* DFS_GetVersion() * Use DFS stat() to return aggregate file size. */ static IOR_offset_t -DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) +DFS_GetFileSize(aiori_mod_opt_t * test, MPI_Comm comm, char *testFileName) { dfs_obj_t *obj; daos_size_t fsize, tmpMin, tmpMax, tmpSum; @@ -745,7 +771,7 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) dfs_release(obj); - if (test->filePerProc == TRUE) { + if (hints->filePerProc == TRUE) { MPI_CHECK(MPI_Allreduce(&fsize, &tmpSum, 1, MPI_LONG_LONG_INT, MPI_SUM, comm), "cannot total data moved"); @@ -770,13 +796,13 @@ DFS_GetFileSize(IOR_param_t * test, MPI_Comm comm, char *testFileName) } static int -DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, IOR_param_t * param) +DFS_Statfs(const char *path, ior_aiori_statfs_t *sfs, aiori_mod_opt_t * param) { return 0; } static int -DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) +DFS_Mkdir(const char *path, mode_t mode, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL; @@ -804,7 +830,7 @@ DFS_Mkdir(const char *path, mode_t mode, IOR_param_t * param) } static int -DFS_Rmdir(const char *path, IOR_param_t * param) +DFS_Rmdir(const char *path, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL; @@ -833,7 +859,7 @@ DFS_Rmdir(const char *path, IOR_param_t * param) } static int -DFS_Access(const char *path, int mode, IOR_param_t * param) +DFS_Access(const char *path, int mode, aiori_mod_opt_t * param) { dfs_obj_t *obj = NULL; mode_t fmode; @@ -850,7 +876,7 @@ DFS_Access(const char *path, int mode, IOR_param_t * param) } static int -DFS_Stat(const char *path, struct stat *buf, IOR_param_t * param) +DFS_Stat(const char *path, struct stat *buf, aiori_mod_opt_t * param) { dfs_obj_t *parent = NULL; char *name = NULL, *dir_name = NULL;