Skip to content
This repository has been archived by the owner on Feb 24, 2018. It is now read-only.

Basic support for non-POSIX backends #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/aiori-HDF5.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ static IOR_offset_t HDF5_GetFileSize(IOR_param_t *, MPI_Comm, char *);

ior_aiori_t hdf5_aiori = {
"HDF5",
NULL, /* no-op init, finalize */
NULL,
HDF5_Create,
HDF5_Open,
HDF5_Xfer,
HDF5_Close,
HDF5_Delete,
HDF5_SetVersion,
HDF5_Fsync,
HDF5_GetFileSize
HDF5_GetFileSize,
POSIX_Access,
POSIX_Mkdir
};

static hid_t xferPropList; /* xfer property list */
Expand Down
6 changes: 5 additions & 1 deletion src/aiori-MPIIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ static void MPIIO_Fsync(void *, IOR_param_t *);

ior_aiori_t mpiio_aiori = {
"MPIIO",
NULL, /* no-op init, finalize */
NULL,
MPIIO_Create,
MPIIO_Open,
MPIIO_Xfer,
MPIIO_Close,
MPIIO_Delete,
MPIIO_SetVersion,
MPIIO_Fsync,
MPIIO_GetFileSize
MPIIO_GetFileSize,
POSIX_Access,
POSIX_Mkdir
};

/***************************** F U N C T I O N S ******************************/
Expand Down
6 changes: 5 additions & 1 deletion src/aiori-NCMPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ static IOR_offset_t NCMPI_GetFileSize(IOR_param_t *, MPI_Comm, char *);

ior_aiori_t ncmpi_aiori = {
"NCMPI",
NULL, /* no-op init, finalize */
NULL,
NCMPI_Create,
NCMPI_Open,
NCMPI_Xfer,
NCMPI_Close,
NCMPI_Delete,
NCMPI_SetVersion,
NCMPI_Fsync,
NCMPI_GetFileSize
NCMPI_GetFileSize,
POSIX_Access,
POSIX_Mkdir
};

/***************************** F U N C T I O N S ******************************/
Expand Down
14 changes: 13 additions & 1 deletion src/aiori-POSIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ static IOR_offset_t POSIX_GetFileSize(IOR_param_t *, MPI_Comm, char *);

ior_aiori_t posix_aiori = {
"POSIX",
NULL, /* no-op init, finalize */
NULL,
POSIX_Create,
POSIX_Open,
POSIX_Xfer,
POSIX_Close,
POSIX_Delete,
POSIX_SetVersion,
POSIX_Fsync,
POSIX_GetFileSize
POSIX_GetFileSize,
POSIX_Access,
POSIX_Mkdir
};

/***************************** F U N C T I O N S ******************************/
Expand Down Expand Up @@ -451,3 +455,11 @@ static IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm,

return (aggFileSizeFromStat);
}

int POSIX_Access(char *testFileName, int mode){
return access(testFileName, mode);
}

int POSIX_Mkdir(char *dir, int mode){
return mkdir(dir, mode);
}
11 changes: 11 additions & 0 deletions src/aiori.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@

typedef struct ior_aiori {
char *name;
/* init and finalizes should be called exactly once during a program
* run */
void (*init)(IOR_param_t *);
void (*finalize)(IOR_param_t *);
void *(*create)(char *, IOR_param_t *);
void *(*open)(char *, IOR_param_t *);
IOR_offset_t (*xfer)(int, void *, IOR_size_t *,
Expand All @@ -60,6 +64,10 @@ typedef struct ior_aiori {
void (*set_version)(IOR_param_t *);
void (*fsync)(void *, IOR_param_t *);
IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *);
/* these functions are expected to behave identically to their POSIX
* equivalents */
int (*access)(char *, int mode);
int (*mkdir)(char *, int mode);
} ior_aiori_t;

ior_aiori_t posix_aiori;
Expand All @@ -70,4 +78,7 @@ ior_aiori_t ncmpi_aiori;
IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm,
char *testFileName);

int POSIX_Access(char *testFileName, int mode);
int POSIX_Mkdir(char *dir, int mode);

#endif /* not _AIORI_H */
21 changes: 15 additions & 6 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,14 +1083,15 @@ static char *PrependDir(IOR_param_t * test, char *rootDir)
sprintf(dir, "%s%d", dir, (rank + rankOffset) % test->numTasks);

/* dir doesn't exist, so create */
if (access(dir, F_OK) != 0) {
if (mkdir(dir, S_IRWXU) < 0) {
if (backend->access(dir, F_OK) != 0) {
if (backend->mkdir(dir, S_IRWXU) < 0) {
ERR("cannot create directory");
}

/* check if correct permissions */
} else if (access(dir, R_OK) != 0 || access(dir, W_OK) != 0 ||
access(dir, X_OK) != 0) {
} else if (backend->access(dir, R_OK) != 0 ||
backend->access(dir, W_OK) != 0 ||
backend->access(dir, X_OK) != 0) {
ERR("invalid directory permissions");
}

Expand Down Expand Up @@ -1261,15 +1262,15 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test)
rankOffset = 0;
GetTestFileName(testFileName, test);
}
if (access(testFileName, F_OK) == 0) {
if (backend->access(testFileName, F_OK) == 0) {
backend->delete(testFileName, test);
}
if (test->reorderTasksRandom == TRUE) {
rankOffset = tmpRankOffset;
GetTestFileName(testFileName, test);
}
} else {
if ((rank == 0) && (access(testFileName, F_OK) == 0)) {
if ((rank == 0) && (backend->access(testFileName, F_OK) == 0)) {
backend->delete(testFileName, test);
}
}
Expand Down Expand Up @@ -1971,6 +1972,10 @@ static void TestIoSys(IOR_test_t *test)

hog_buf = HogMemory(params);

/* do backend-specific initialization */
if (backend->init)
backend->init(params);

startTime = GetTimeStamp();

/* loop over test iterations */
Expand Down Expand Up @@ -2228,6 +2233,10 @@ static void TestIoSys(IOR_test_t *test)
rankOffset = 0;
}

/* do backend-specific finalization */
if (backend->finalize)
backend->finalize(params);

MPI_CHECK(MPI_Comm_free(&testComm), "MPI_Comm_free() error");

if (params->summary_every_test) {
Expand Down