56 if (init_values !=
NULL){
73 memcpy(help, h,
sizeof(h));
109 && (
sizeof(MPI_Aint) < 8)
112 ERR(
"segment size must be < 2GiB");
114 ERR(
"shared file pointer not implemented");
118 ERR(
"need larger file size for strided datatype in MPIIO");
120 ERR(
"random offset not available with collective MPIIO");
122 ERR(
"random offset not available with MPIIO fileviews");
137 int mpi_mode = MPI_MODE_UNIQUE_OPEN;
138 MPI_Info mpiHints = MPI_INFO_NULL;
140 if ((mode & W_OK) && (mode & R_OK))
141 mpi_mode |= MPI_MODE_RDWR;
142 else if (mode & W_OK)
143 mpi_mode |= MPI_MODE_WRONLY;
145 mpi_mode |= MPI_MODE_RDONLY;
149 int ret = MPI_File_open(MPI_COMM_SELF, path, mpi_mode, mpiHints, &fd);
154 if (mpiHints != MPI_INFO_NULL)
155 MPI_CHECK(MPI_Info_free(&mpiHints),
"MPI_Info_free failed");
164 return MPIIO_Open(testFileName, iorflags, module_options);
173 int fd_mode = (int)0,
182 MPI_Info mpiHints = MPI_INFO_NULL;
187 fd_mode |= MPI_MODE_RDONLY;
190 fd_mode |= MPI_MODE_WRONLY;
193 fd_mode |= MPI_MODE_RDWR;
196 fd_mode |= MPI_MODE_APPEND;
199 fd_mode |= MPI_MODE_CREATE;
202 fd_mode |= MPI_MODE_EXCL;
205 fprintf(stdout,
"O_DIRECT not implemented in MPIIO\n");
213 fd_mode |= MPI_MODE_UNIQUE_OPEN;
216 comm = MPI_COMM_SELF;
230 fprintf(stdout,
"\nhints passed to MPI_File_open() {\n");
232 fprintf(stdout,
"}\n");
235 MPI_CHECKF(MPI_File_open(comm, testFileName, fd_mode, mpiHints, & mfd->fd),
236 "cannot open file: %s", testFileName);
238 MPI_CHECKF(MPI_File_set_size(mfd->fd, 0),
"cannot truncate file: %s", testFileName);
244 if (mpiHints != MPI_INFO_NULL)
245 MPI_CHECK(MPI_Info_free(&mpiHints),
"MPI_Info_free failed");
246 MPI_CHECK(MPI_File_get_info(mfd->fd, &mpiHints),
247 "cannot get file info");
248 fprintf(stdout,
"\nhints returned from opened file {\n");
250 fprintf(stdout,
"}\n");
260 "cannot preallocate file");
268 MPI_CHECK(MPI_Type_create_resized( mfd->contigType, 0, 0, & mfd->transferType),
"cannot create resized type");
269 MPI_CHECK(MPI_Type_commit(& mfd->contigType),
"cannot commit datatype");
270 MPI_CHECK(MPI_Type_commit(& mfd->transferType),
"cannot commit datatype");
284 struct fileTypeStruct {
285 int globalSizes[2], localSizes[2], startIndices[2];
291 fileTypeStruct.globalSizes[0] = 1;
292 fileTypeStruct.globalSizes[1] = transfersPerBlock * tasksPerFile;
293 fileTypeStruct.localSizes[0] = 1;
294 fileTypeStruct.localSizes[1] = transfersPerBlock;
295 fileTypeStruct.startIndices[0] = 0;
296 fileTypeStruct.startIndices[1] = transfersPerBlock * offsetFactor;
299 (2, fileTypeStruct.globalSizes,
300 fileTypeStruct.localSizes,
301 fileTypeStruct.startIndices, MPI_ORDER_C,
302 mfd->contigType, & mfd->fileType),
303 "cannot create subarray");
304 MPI_CHECK(MPI_Type_commit(& mfd->fileType),
"cannot commit datatype");
309 (MPI_Info) MPI_INFO_NULL),
310 "cannot set file view");
312 MPI_CHECK(MPI_Type_create_resized(mfd->contigType, 0, tasksPerFile * hints->
blockSize, & mfd->fileType),
"cannot create MPI_Type_create_hvector");
313 MPI_CHECK(MPI_Type_commit(& mfd->fileType),
"cannot commit datatype");
317 if (mpiHints != MPI_INFO_NULL)
318 MPI_CHECK(MPI_Info_free(&mpiHints),
"MPI_Info_free failed");
319 return ((
void *) mfd);
337 int (
MPIAPI * Access) (MPI_File,
void *, int,
338 MPI_Datatype, MPI_Status *);
339 int (
MPIAPI * Access_at) (MPI_File, MPI_Offset,
void *, int,
340 MPI_Datatype, MPI_Status *);
341 int (
MPIAPI * Access_all) (MPI_File,
void *, int,
342 MPI_Datatype, MPI_Status *);
343 int (
MPIAPI * Access_at_all) (MPI_File, MPI_Offset,
void *, int,
344 MPI_Datatype, MPI_Status *);
354 if (access ==
WRITE) {
355 Access = (int (
MPIAPI *)(MPI_File,
void *, int,
356 MPI_Datatype, MPI_Status *)) MPI_File_write;
357 Access_at = (int (
MPIAPI *)(MPI_File, MPI_Offset,
void *, int,
358 MPI_Datatype, MPI_Status *)) MPI_File_write_at;
359 Access_all = (int (
MPIAPI *) (MPI_File,
void *, int,
360 MPI_Datatype, MPI_Status *)) MPI_File_write_all;
361 Access_at_all = (int (
MPIAPI *) (MPI_File, MPI_Offset,
void *, int,
362 MPI_Datatype, MPI_Status *)) MPI_File_write_at_all;
369 Access = MPI_File_read;
370 Access_at = MPI_File_read_at;
371 Access_all = MPI_File_read_all;
372 Access_at_all = MPI_File_read_at_all;
408 (MPI_Info) MPI_INFO_NULL),
"cannot set file view");
416 (mfd->
fd, buffer, length,
418 "cannot access collective");
422 (mfd->
fd, buffer, length,
424 "cannot access noncollective");
441 (mfd->
fd, offset, module_options) < 0) {
454 "useSharedFilePointer not implemented\n");
461 buffer, length, MPI_BYTE, &status),
462 "cannot access explicit, collective");
467 buffer, length, MPI_BYTE, &status),
468 "cannot access explicit, noncollective");
484 if (MPI_File_sync(mfd->
fd) != MPI_SUCCESS)
485 WARN(
"fsync() failed");
496 MPI_CHECK(MPI_File_close(& mfd->
fd),
"cannot close file");
517 MPI_CHECKF(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL),
518 "cannot delete file: %s", testFileName);
526 static char ver[1024] = {};
527 int version, subversion;
528 MPI_CHECK(MPI_Get_version(&version, &subversion),
"cannot get MPI version");
529 sprintf(ver,
"(%d.%d)", version, subversion);
540 int offsetFactor, tasksPerFile;
565 + (((tempOffset % (hints->
blockSize * tasksPerFile))
570 MPI_CHECK(MPI_File_seek(fd, tempOffset, MPI_SEEK_SET),
571 "cannot seek offset");
584 IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
587 MPI_Info mpiHints = MPI_INFO_NULL;
590 comm = MPI_COMM_SELF;
597 MPI_CHECK(MPI_File_open(comm, testFileName, MPI_MODE_RDONLY,
599 "cannot open file to get file size");
600 MPI_CHECK(MPI_File_get_size(fd, (MPI_Offset *) & aggFileSizeFromStat),
601 "cannot get file size");
602 MPI_CHECK(MPI_File_close(&fd),
"cannot close file");
603 if (mpiHints != MPI_INFO_NULL)
604 MPI_CHECK(MPI_Info_free(&mpiHints),
"MPI_Info_free failed");
606 return (aggFileSizeFromStat);
static aiori_fd_t * MPIIO_Create(char *, int iorflags, aiori_mod_opt_t *)
void ShowHints(MPI_Info *mpiHints)
IOR_offset_t segmentCount
static aiori_xfer_hint_t * hints
#define MPI_CHECKF(MPI_STATUS, FORMAT,...)
struct benchmark_options o
static int MPIIO_check_params(aiori_mod_opt_t *options)
IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t *module_options, char *testFileName)
#define MPI_CHECK(MPI_STATUS, MSG)
int aiori_posix_stat(const char *path, struct stat *buf, aiori_mod_opt_t *module_options)
int MPIIO_Access(const char *path, int mode, aiori_mod_opt_t *module_options)
static option_help options[]
static aiori_fd_t * MPIIO_Open(char *, int flags, aiori_mod_opt_t *)
void MPIIO_xfer_hints(aiori_xfer_hint_t *params)
IOR_offset_t transferSize
static option_help * MPIIO_options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
static IOR_offset_t SeekOffset(MPI_File, IOR_offset_t, aiori_mod_opt_t *)
static IOR_offset_t MPIIO_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
static char * MPIIO_GetVersion()
int aiori_posix_rmdir(const char *path, aiori_mod_opt_t *module_options)
int aiori_posix_mkdir(const char *path, mode_t mode, aiori_mod_opt_t *module_options)
static void MPIIO_Close(aiori_fd_t *, aiori_mod_opt_t *)
int aiori_posix_statfs(const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t *module_options)
MPI_Datatype transferType
void SetHints(MPI_Info *mpiHints, char *hintsFileName)
void MPIIO_Delete(char *testFileName, aiori_mod_opt_t *module_options)
long long int IOR_offset_t
static void MPIIO_Fsync(aiori_fd_t *, aiori_mod_opt_t *)