Created dummy option type to provide type safety. Fixed various call issues for options.

master
Julian M. Kunkel 2020-05-31 11:50:15 +01:00
parent e91b79cea0
commit 294b8891e6
11 changed files with 205 additions and 201 deletions

View File

@ -25,7 +25,7 @@ typedef struct {
static char * current = (char*) 1; 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)); dummy_options_t * o = malloc(sizeof(dummy_options_t));
if (init_values != NULL){ if (init_values != NULL){
memcpy(o, init_values, sizeof(dummy_options_t)); 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)); memset(o, 0, sizeof(dummy_options_t));
} }
*init_backend_options = o; *init_backend_options = (airori_mod_opt_t*) o;
option_help h [] = { option_help h [] = {
{0, "dummy.delay-create", "Delay per create in usec", OPTION_OPTIONAL_ARGUMENT, 'l', & o->delay_creates}, {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 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){ if(count_init <= 0){
ERR("DUMMY missing initialization in create\n"); ERR("DUMMY missing initialization in create\n");
@ -56,7 +56,7 @@ static void *DUMMY_Create(char *testFileName, int iorflags, void * param)
if(verbose > 4){ if(verbose > 4){
fprintf(out_logfile, "DUMMY create: %s = %p\n", testFileName, current); 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_creates){
if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ 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)}; 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++; 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){ if(count_init <= 0){
ERR("DUMMY missing initialization in open\n"); ERR("DUMMY missing initialization in open\n");
@ -77,7 +77,7 @@ static void *DUMMY_Open(char *testFileName, int flags, void * param)
return current++; return current++;
} }
static void DUMMY_Fsync(void *fd, void * param) static void DUMMY_Fsync(void *fd, airori_mod_opt_t * options)
{ {
if(verbose > 4){ if(verbose > 4){
fprintf(out_logfile, "DUMMY fsync %p\n", fd); 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){ if(verbose > 4){
fprintf(out_logfile, "DUMMY close %p\n", fd); 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){ if(verbose > 4){
fprintf(out_logfile, "DUMMY delete: %s\n", testFileName); fprintf(out_logfile, "DUMMY delete: %s\n", testFileName);
@ -108,7 +108,7 @@ static char * DUMMY_getVersion()
return "0.5"; 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){ if(verbose > 4){
fprintf(out_logfile, "DUMMY getFileSize: %s\n", testFileName); 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; 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){ if(verbose > 4){
fprintf(out_logfile, "DUMMY xfer: %p\n", file); 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_xfer){
if (! o->delay_rank_0_only || (o->delay_rank_0_only && rank == 0)){ 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)}; 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; 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_bsize = 1;
stat->f_blocks = 1; stat->f_blocks = 1;
stat->f_bfree = 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; 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; 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; 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; 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; return 0;
} }
static int DUMMY_check_params(void * test){ static int DUMMY_check_params(airori_mod_opt_t * options){
return 0; return 0;
} }
static void DUMMY_init(void * options){ static void DUMMY_init(airori_mod_opt_t * options){
WARN("DUMMY initialized"); WARN("DUMMY initialized");
count_init++; count_init++;
} }
static void DUMMY_final(void * options){ static void DUMMY_final(airori_mod_opt_t * options){
WARN("DUMMY finalized"); WARN("DUMMY finalized");
if(count_init <= 0){ if(count_init <= 0){
ERR("DUMMY invalid finalization\n"); ERR("DUMMY invalid finalization\n");

View File

@ -81,20 +81,20 @@
#endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */ #endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */
/**************************** P R O T O T Y P E S *****************************/ /**************************** P R O T O T Y P E S *****************************/
static IOR_offset_t SeekOffset(void *, IOR_offset_t, void *); static IOR_offset_t SeekOffset(void *, IOR_offset_t, airori_mod_opt_t *);
static void SetupDataSet(void *, void *); static void SetupDataSet(void *, airori_mod_opt_t *);
static void *HDF5_Create(char *, int flags, void *); static void *HDF5_Create(char *, int flags, airori_mod_opt_t *);
static void *HDF5_Open(char *, int flags, void *); static void *HDF5_Open(char *, int flags, airori_mod_opt_t *);
static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *, static IOR_offset_t HDF5_Xfer(int, void *, IOR_size_t *,
IOR_offset_t, void *); IOR_offset_t, airori_mod_opt_t *);
static void HDF5_Close(void *, void *); static void HDF5_Close(void *, airori_mod_opt_t *);
static void HDF5_Delete(char *, void *); static void HDF5_Delete(char *, airori_mod_opt_t *);
static char* HDF5_GetVersion(); static char* HDF5_GetVersion();
static void HDF5_Fsync(void *, void *); static void HDF5_Fsync(void *, airori_mod_opt_t *);
static IOR_offset_t HDF5_GetFileSize(void *, MPI_Comm, char *); static IOR_offset_t HDF5_GetFileSize(airori_mod_opt_t *, MPI_Comm, char *);
static int HDF5_Access(const char *, int, void *); static int HDF5_Access(const char *, int, airori_mod_opt_t *);
static void HDF5_init_xfer_options(IOR_param_t * params); 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 *****************************/ /************************** O P T I O N S *****************************/
typedef struct{ typedef struct{
@ -107,7 +107,7 @@ typedef struct{
} HDF5_options_t; } HDF5_options_t;
/***************************** F U N C T I O N S ******************************/ /***************************** 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)); HDF5_options_t * o = malloc(sizeof(HDF5_options_t));
if (init_values != NULL){ if (init_values != NULL){
@ -119,7 +119,7 @@ static option_help * HDF5_options(void ** init_backend_options, void * init_valu
o->setAlignment = 1; o->setAlignment = 1;
} }
*init_backend_options = o; *init_backend_options = (airori_mod_opt_t*) o;
option_help h [] = { option_help h [] = {
{0, "hdf5.collectiveMetadata", "Use collectiveMetadata (available since HDF5-1.10.0)", OPTION_FLAG, 'd', & o->collective_md}, {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; 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; HDF5_options_t *o = (HDF5_options_t*) options;
if (o->setAlignment < 0) if (o->setAlignment < 0)
ERR("alignment must be non-negative integer"); 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. * 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); 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. * 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; HDF5_options_t *o = (HDF5_options_t*) param;
hid_t accessPropList, createPropList; 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. * 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, 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; static int firstReadCheck = FALSE, startNewDataSet;
IOR_offset_t segmentPosition, segmentSize; 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(). * 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. * 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) if(ior_param->dryRun)
return; return;
@ -524,7 +524,7 @@ static void HDF5_Close(void *fd, void * param)
/* /*
* Delete a file through the HDF5 interface. * 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) if(ior_param->dryRun)
return return
@ -558,7 +558,7 @@ static char * HDF5_GetVersion()
* Seek to offset in file using the HDF5 interface and set up hyperslab. * Seek to offset in file using the HDF5 interface and set up hyperslab.
*/ */
static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset, 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; HDF5_options_t *o = (HDF5_options_t*) param;
IOR_offset_t segmentSize; IOR_offset_t segmentSize;
@ -598,7 +598,7 @@ static IOR_offset_t SeekOffset(void *fd, IOR_offset_t offset,
/* /*
* Create HDF5 data set. * 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; HDF5_options_t *o = (HDF5_options_t*) param;
char dataSetName[MAX_STR]; char dataSetName[MAX_STR];
@ -661,7 +661,7 @@ static void SetupDataSet(void *fd, void * param)
* Use MPIIO call to get file size. * Use MPIIO call to get file size.
*/ */
static IOR_offset_t 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) if(ior_param->dryRun)
return 0; return 0;
@ -671,7 +671,7 @@ HDF5_GetFileSize(void * test, MPI_Comm testComm, char *testFileName)
/* /*
* Use MPIIO call to check for access. * 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) if(ior_param->dryRun)
return 0; return 0;

View File

@ -26,15 +26,15 @@
#include "utilities.h" #include "utilities.h"
/**************************** P R O T O T Y P E S *****************************/ /**************************** P R O T O T Y P E S *****************************/
static void *MMAP_Create(char *, int flags, void *); static void *MMAP_Create(char *, int flags, airori_mod_opt_t *);
static void *MMAP_Open(char *, int flags, void *); static void *MMAP_Open(char *, int flags, airori_mod_opt_t *);
static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *, static IOR_offset_t MMAP_Xfer(int, void *, IOR_size_t *,
IOR_offset_t, void *); IOR_offset_t, airori_mod_opt_t *);
static void MMAP_Close(void *, void *); static void MMAP_Close(void *, airori_mod_opt_t *);
static void MMAP_Fsync(void *, void *); static void MMAP_Fsync(void *, airori_mod_opt_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);
static void MMAP_init_xfer_options(IOR_param_t * params); 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 ***************************/ /************************** D E C L A R A T I O N S ***************************/
ior_aiori_t mmap_aiori = { ior_aiori_t mmap_aiori = {
@ -61,7 +61,7 @@ typedef struct{
int madv_pattern; int madv_pattern;
} mmap_options_t; } 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)); mmap_options_t * o = malloc(sizeof(mmap_options_t));
if (init_values != NULL){ 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)); memset(o, 0, sizeof(mmap_options_t));
} }
*init_backend_options = o; *init_backend_options = (airori_mod_opt_t*) o;
option_help h [] = { option_help h [] = {
{0, "mmap.madv_dont_need", "Use advise don't need", OPTION_FLAG, 'd', & o->madv_dont_need}, {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); 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))) if (ior_param->fsyncPerWrite && (ior_param->transferSize & (sysconf(_SC_PAGESIZE) - 1)))
ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite"); ERR("transfer size must be aligned with PAGESIZE for MMAP with fsyncPerWrite");
return 0; 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. * 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; 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. * 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; int *fd;
fd = POSIX_Open(testFileName, flags, param); 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 * 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, 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; mmap_options_t *o = (mmap_options_t*) param;
if (access == WRITE) { if (access == WRITE) {
@ -178,7 +178,7 @@ static IOR_offset_t MMAP_Xfer(int access, void *file, IOR_size_t * buffer,
/* /*
* Perform msync(). * 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; mmap_options_t *o = (mmap_options_t*) param;
if (msync(o->mmap_ptr, ior_param->expectedAggFileSize, MS_SYNC) != 0) 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. * 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; mmap_options_t *o = (mmap_options_t*) param;
if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0) if (munmap(o->mmap_ptr, ior_param->expectedAggFileSize) != 0)

View File

@ -31,20 +31,26 @@
/**************************** P R O T O T Y P E S *****************************/ /**************************** 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_Create(char *, int iorflags, airori_mod_opt_t *);
static void *MPIIO_Open(char *, int flags, void *); static void *MPIIO_Open(char *, int flags, airori_mod_opt_t *);
static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *, static IOR_offset_t MPIIO_Xfer(int, void *, IOR_size_t *,
IOR_offset_t, void *); IOR_offset_t, airori_mod_opt_t *);
static void MPIIO_Close(void *, void *); static void MPIIO_Close(void *, airori_mod_opt_t *);
static char* MPIIO_GetVersion(); 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 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 ***************************/ /************************** 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 { typedef struct {
int dry_run; int dry_run;
int showHints; /* show hints */ int showHints; /* show hints */
@ -55,14 +61,14 @@ typedef struct {
char * hintsFileName; /* full name for hints file */ char * hintsFileName; /* full name for hints file */
} mpiio_options_t; } 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)); mpiio_options_t * o = malloc(sizeof(mpiio_options_t));
if (init_values != NULL){ if (init_values != NULL){
memcpy(o, init_values, sizeof(mpiio_options_t)); memcpy(o, init_values, sizeof(mpiio_options_t));
}else{ }else{
memset(o, 0, sizeof(mpiio_options_t)); memset(o, 0, sizeof(mpiio_options_t));
} }
*init_backend_options = o; *init_backend_options = (airori_mod_opt_t*) o;
option_help h [] = { option_help h [] = {
{0, "mpiio.dryRun", "Dry run, disable actual IO", OPTION_FLAG, 'd', & o->dry_run}, {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; 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
if ((param->useFileView == TRUE) if ((param->useFileView == TRUE)
&& (sizeof(MPI_Aint) < 8) /* used for 64-bit datatypes */ && (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. * 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
if(param->dry_run){ 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. * 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); 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. * 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
int fd_mode = (int)0, int fd_mode = (int)0,
@ -184,16 +190,12 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options)
struct fileTypeStruct { struct fileTypeStruct {
int globalSizes[2], localSizes[2], startIndices[2]; int globalSizes[2], localSizes[2], startIndices[2];
} fileTypeStruct; } fileTypeStruct;
MPI_File *fd;
mpiio_fd_t * mfd = malloc(sizeof(mpiio_fd_t));
memset(mfd, 0, sizeof(mpiio_fd_t));
MPI_Comm comm; MPI_Comm comm;
MPI_Info mpiHints = MPI_INFO_NULL; 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 */ /* set IOR file flags to MPIIO flags */
/* -- file open flags -- */ /* -- file open flags -- */
if (flags & IOR_RDONLY) { if (flags & IOR_RDONLY) {
@ -214,9 +216,6 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options)
if (flags & IOR_EXCL) { if (flags & IOR_EXCL) {
fd_mode |= MPI_MODE_EXCL; fd_mode |= MPI_MODE_EXCL;
} }
if (flags & IOR_TRUNC) {
fprintf(stdout, "File truncation not implemented in MPIIO\n");
}
if (flags & IOR_DIRECT) { if (flags & IOR_DIRECT) {
fprintf(stdout, "O_DIRECT not implemented in MPIIO\n"); 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"); fprintf(stdout, "}\n");
} }
if(! param->dry_run){ 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); "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 */ /* show hints actually attached to file handle */
if (rank == 0 && param->showHints && ! param->dry_run) { if (rank == 0 && param->showHints && ! param->dry_run) {
if (mpiHints != MPI_INFO_NULL) if (mpiHints != MPI_INFO_NULL)
MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); 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"); "cannot get file info");
fprintf(stdout, "\nhints returned from opened file {\n"); fprintf(stdout, "\nhints returned from opened file {\n");
ShowHints(&mpiHints); ShowHints(&mpiHints);
@ -265,7 +267,7 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options)
/* preallocate space for file */ /* preallocate space for file */
if (param->preallocate && ior_param->open == WRITE && ! param->dry_run) { 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 (MPI_Offset) (ior_param->segmentCount
* *
ior_param->blockSize * ior_param->blockSize *
@ -277,9 +279,9 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options)
/* create contiguous transfer datatype */ /* create contiguous transfer datatype */
MPI_CHECK(MPI_Type_contiguous MPI_CHECK(MPI_Type_contiguous
(ior_param->transferSize / sizeof(IOR_size_t), (ior_param->transferSize / sizeof(IOR_size_t),
MPI_LONG_LONG_INT, &ior_param->transferType), MPI_LONG_LONG_INT, & mfd->transferType),
"cannot create contiguous datatype"); "cannot create contiguous datatype");
MPI_CHECK(MPI_Type_commit(&ior_param->transferType), MPI_CHECK(MPI_Type_commit(& mfd->transferType),
"cannot commit datatype"); "cannot commit datatype");
if (ior_param->filePerProc) { if (ior_param->filePerProc) {
offsetFactor = 0; offsetFactor = 0;
@ -305,29 +307,29 @@ static void *MPIIO_Open(char *testFileName, int flags, void * module_options)
(2, fileTypeStruct.globalSizes, (2, fileTypeStruct.globalSizes,
fileTypeStruct.localSizes, fileTypeStruct.localSizes,
fileTypeStruct.startIndices, MPI_ORDER_C, fileTypeStruct.startIndices, MPI_ORDER_C,
ior_param->transferType, &ior_param->fileType), mfd->transferType, & mfd->fileType),
"cannot create subarray"); "cannot create subarray");
MPI_CHECK(MPI_Type_commit(&ior_param->fileType), MPI_CHECK(MPI_Type_commit(& mfd->fileType),
"cannot commit datatype"); "cannot commit datatype");
if(! param->dry_run){ if(! param->dry_run){
MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0, MPI_CHECK(MPI_File_set_view(mfd->fd, (MPI_Offset) 0,
ior_param->transferType, mfd->transferType,
ior_param->fileType, "native", mfd->fileType, "native",
(MPI_Info) MPI_INFO_NULL), (MPI_Info) MPI_INFO_NULL),
"cannot set file view"); "cannot set file view");
} }
} }
if (mpiHints != MPI_INFO_NULL) if (mpiHints != MPI_INFO_NULL)
MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); 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. * Write or read access to file using the MPIIO interface.
*/ */
static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer, static IOR_offset_t MPIIO_Xfer(int access, void * fdp, IOR_size_t * buffer,
IOR_offset_t length, void * module_options) IOR_offset_t length, airori_mod_opt_t * module_options)
{ {
/* NOTE: The second arg is (void *) for reads, and (const void *) /* NOTE: The second arg is (void *) for reads, and (const void *)
for writes. Therefore, one of the two sets of assignments below 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
if(param->dry_run) if(param->dry_run)
return length; return length;
mpiio_fd_t * mfd = (mpiio_fd_t*) fdp;
int (MPIAPI * Access) (MPI_File, void *, int, int (MPIAPI * Access) (MPI_File, void *, int,
MPI_Datatype, MPI_Status *); 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) { if (param->useFileView) {
/* find offset in file */ /* find offset in file */
if (SeekOffset(*(MPI_File *) fd, ior_param->offset, param) < if (SeekOffset(mfd->fd, ior_param->offset, module_options) <
0) { 0) {
/* if unsuccessful */ /* if unsuccessful */
length = -1; length = -1;
@ -404,14 +407,14 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer,
if (ior_param->collective) { if (ior_param->collective) {
/* individual, collective call */ /* individual, collective call */
MPI_CHECK(Access_all MPI_CHECK(Access_all
(*(MPI_File *) fd, buffer, length, (mfd->fd, buffer, length,
ior_param->transferType, &status), mfd->transferType, &status),
"cannot access collective"); "cannot access collective");
} else { } else {
/* individual, noncollective call */ /* individual, noncollective call */
MPI_CHECK(Access MPI_CHECK(Access
(*(MPI_File *) fd, buffer, length, (mfd->fd, buffer, length,
ior_param->transferType, &status), mfd->transferType, &status),
"cannot access noncollective"); "cannot access noncollective");
} }
length *= ior_param->transferSize; /* for return value in bytes */ 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) { if (param->useSharedFilePointer) {
/* find offset in file */ /* find offset in file */
if (SeekOffset if (SeekOffset
(*(MPI_File *) fd, ior_param->offset, param) < 0) { (mfd->fd, ior_param->offset, module_options) < 0) {
/* if unsuccessful */ /* if unsuccessful */
length = -1; length = -1;
} else { } else {
@ -443,13 +446,13 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer,
if (ior_param->collective) { if (ior_param->collective) {
/* explicit, collective call */ /* explicit, collective call */
MPI_CHECK(Access_at_all MPI_CHECK(Access_at_all
(*(MPI_File *) fd, ior_param->offset, (mfd->fd, ior_param->offset,
buffer, length, MPI_BYTE, &status), buffer, length, MPI_BYTE, &status),
"cannot access explicit, collective"); "cannot access explicit, collective");
} else { } else {
/* explicit, noncollective call */ /* explicit, noncollective call */
MPI_CHECK(Access_at MPI_CHECK(Access_at
(*(MPI_File *) fd, ior_param->offset, (mfd->fd, ior_param->offset,
buffer, length, MPI_BYTE, &status), buffer, length, MPI_BYTE, &status),
"cannot access explicit, noncollective"); "cannot access explicit, noncollective");
} }
@ -461,40 +464,40 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer,
/* /*
* Perform fsync(). * 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
if(param->dry_run) if(param->dry_run)
return; 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"); EWARN("fsync() failed");
} }
/* /*
* Close a file through the MPIIO interface. * 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_options_t * param = (mpiio_options_t*) module_options;
mpiio_fd_t * mfd = (mpiio_fd_t*) fdp;
if(! param->dry_run){ 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)) { if (param->useFileView == TRUE) {
// /* /*
// * need to free the datatype, so done in the close process * need to free the datatype, so done in the close process
// */ */
// MPI_CHECK(MPI_Type_free(&param->fileType), MPI_CHECK(MPI_Type_free(& mfd->fileType), "cannot free MPI file datatype");
// "cannot free MPI file datatype"); MPI_CHECK(MPI_Type_free(& mfd->transferType), "cannot free MPI transfer datatype");
// MPI_CHECK(MPI_Type_free(&param->transferType), }
// "cannot free MPI transfer datatype"); free(fdp);
//}
free(fd);
} }
/* /*
* Delete a file through the MPIIO interface. * 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
if(param->dry_run) if(param->dry_run)
@ -519,7 +522,7 @@ static char* MPIIO_GetVersion()
* Seek to offset in file using the MPIIO interface. * Seek to offset in file using the MPIIO interface.
*/ */
static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset, 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; mpiio_options_t * param = (mpiio_options_t*) module_options;
int offsetFactor, tasksPerFile; 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. * Use MPI_File_get_size() to return aggregate file size.
* NOTE: This function is used by the HDF5 and NCMPI backends. * 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) char *testFileName)
{ {
mpiio_options_t * test = (mpiio_options_t*) module_options; mpiio_options_t * test = (mpiio_options_t*) module_options;

View File

@ -69,10 +69,10 @@
/**************************** P R O T O T Y P E S *****************************/ /**************************** 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, void *, IOR_size_t *,
IOR_offset_t, void *); IOR_offset_t, airori_mod_opt_t *);
static void POSIX_Fsync(void *, void *); static void POSIX_Fsync(void *, airori_mod_opt_t *);
static void POSIX_Sync(void * ); static void POSIX_Sync(airori_mod_opt_t * );
static int POSIX_check_params(void * options); static int POSIX_check_params(airori_mod_opt_t * options);
/************************** O P T I O N S *****************************/ /************************** O P T I O N S *****************************/
typedef struct{ typedef struct{
@ -97,7 +97,7 @@ typedef struct{
} posix_options_t; } 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)); posix_options_t * o = malloc(sizeof(posix_options_t));
if (init_values != NULL){ if (init_values != NULL){
@ -110,7 +110,7 @@ option_help * POSIX_options(void ** init_backend_options, void * init_values){
o->beegfs_chunkSize = -1; o->beegfs_chunkSize = -1;
} }
*init_backend_options = o; *init_backend_options = (airori_mod_opt_t*) o;
option_help h [] = { option_help h [] = {
{0, "posix.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io}, {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; 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; posix_options_t * o = (posix_options_t*) param;
if (ior_param->useExistingTestFile && o->lustre_set_striping) if (ior_param->useExistingTestFile && o->lustre_set_striping)
ERR("Lustre stripe options are incompatible with useExistingTestFile"); 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. * 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 fd_oflag = O_BINARY;
int mode = 0664; int mode = 0664;
@ -503,7 +503,7 @@ int POSIX_Mknod(char *testFileName)
/* /*
* Open a file through the POSIX interface. * 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_oflag = O_BINARY;
int *fd; 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. * 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, void *file, IOR_size_t * buffer,
IOR_offset_t length, void * param) IOR_offset_t length, airori_mod_opt_t * param)
{ {
int xferRetries = 0; int xferRetries = 0;
long long remaining = (long long)length; 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(). * 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) if (fsync(*(int *)fd) != 0)
EWARNF("fsync(%d) failed", *(int *)fd); 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"); int ret = system("sync");
if (ret != 0){ if (ret != 0){
@ -653,7 +653,7 @@ static void POSIX_Sync(void * param)
/* /*
* Close a file through the POSIX interface. * 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) if(ior_param->dryRun)
return; return;
@ -665,7 +665,7 @@ void POSIX_Close(void *fd, void * param)
/* /*
* Delete a file through the POSIX interface. * 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) if(ior_param->dryRun)
return; return;
@ -678,7 +678,7 @@ void POSIX_Delete(char *testFileName, void * param)
/* /*
* Use POSIX stat() to return aggregate file size. * 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) char *testFileName)
{ {
if(ior_param->dryRun) if(ior_param->dryRun)

View File

@ -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 * This function provides a AIORI statfs for POSIX-compliant filesystems. It
* uses statvfs is available and falls back on statfs. * 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; int ret;
#if defined(HAVE_STATVFS) #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; 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); 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); 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); 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); return stat (path, buf);
} }

View File

@ -63,35 +63,40 @@ typedef struct ior_aiori_statfs {
uint64_t f_ffree; uint64_t f_ffree;
} ior_aiori_statfs_t; } 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 { typedef struct ior_aiori {
char *name; char *name;
char *name_legacy; char *name_legacy;
void *(*create)(char *, int iorflags, void *); void *(*create)(char *, int iorflags, airori_mod_opt_t *);
int (*mknod)(char *); 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. Allow to set generic transfer options that shall be applied to any subsequent IO call.
*/ */
void (*init_xfer_options)(IOR_param_t * params); void (*init_xfer_options)(IOR_param_t * params);
IOR_offset_t (*xfer)(int, void *, IOR_size_t *, IOR_offset_t (*xfer)(int, void *, IOR_size_t *,
IOR_offset_t, void *); IOR_offset_t, airori_mod_opt_t *);
void (*close)(void *, void *); void (*close)(void *, airori_mod_opt_t *);
void (*delete)(char *, void *); void (*delete)(char *, airori_mod_opt_t *);
char* (*get_version)(void); char* (*get_version)(void);
void (*fsync)(void *, void *); void (*fsync)(void *, airori_mod_opt_t *);
IOR_offset_t (*get_file_size)(void * module_options, MPI_Comm, char *); IOR_offset_t (*get_file_size)(airori_mod_opt_t * module_options, MPI_Comm, char *);
int (*statfs) (const char *, ior_aiori_statfs_t *, void * module_options); int (*statfs) (const char *, ior_aiori_statfs_t *, airori_mod_opt_t * module_options);
int (*mkdir) (const char *path, mode_t mode, void * module_options); int (*mkdir) (const char *path, mode_t mode, airori_mod_opt_t * module_options);
int (*rmdir) (const char *path, void * module_options); int (*rmdir) (const char *path, airori_mod_opt_t * module_options);
int (*access) (const char *path, int mode, void * module_options); int (*access) (const char *path, int mode, airori_mod_opt_t * module_options);
int (*stat) (const char *path, struct stat *buf, void * module_options); int (*stat) (const char *path, struct stat *buf, airori_mod_opt_t * module_options);
void (*initialize)(void * options); /* called once per program before MPI is started */ void (*initialize)(airori_mod_opt_t * options); /* called once per program before MPI is started */
void (*finalize)(void * options); /* called once per program after MPI is shutdown */ void (*finalize)(airori_mod_opt_t * 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 */ 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; 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; } ior_aiori_t;
enum bench_type { enum bench_type {
@ -127,26 +132,25 @@ const char *aiori_default (void);
/* some generic POSIX-based backend calls */ /* some generic POSIX-based backend calls */
char * aiori_get_version (void); char * aiori_get_version (void);
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 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);
int aiori_posix_rmdir (const char *path, void * module_options); int aiori_posix_rmdir (const char *path, airori_mod_opt_t * module_options);
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);
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);
void aiori_posix_init_xfer_options(IOR_param_t * params); 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); int POSIX_Mknod(char *testFileName);
void *POSIX_Open(char *testFileName, int flags, void * module_options); void *POSIX_Open(char *testFileName, int flags, airori_mod_opt_t * module_options);
IOR_offset_t POSIX_GetFileSize(void * test, MPI_Comm testComm, char *testFileName); IOR_offset_t POSIX_GetFileSize(airori_mod_opt_t * test, MPI_Comm testComm, char *testFileName);
void POSIX_Delete(char *testFileName, void * module_options); void POSIX_Delete(char *testFileName, airori_mod_opt_t * module_options);
void POSIX_Close(void *fd, void * module_options); void POSIX_Close(void *fd, airori_mod_opt_t * module_options);
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);
/* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */ /* NOTE: these 3 MPI-IO functions are exported for reuse by HDF5/PNetCDF */
void MPIIO_Delete(char *testFileName, void * module_options); void MPIIO_Delete(char *testFileName, airori_mod_opt_t * module_options);
IOR_offset_t MPIIO_GetFileSize(void * test, MPI_Comm testComm, IOR_offset_t MPIIO_GetFileSize(airori_mod_opt_t * options, MPI_Comm testComm, char *testFileName);
char *testFileName); int MPIIO_Access(const char *, int, airori_mod_opt_t *);
int MPIIO_Access(const char *, int, void *);
#endif /* not _AIORI_H */ #endif /* not _AIORI_H */

View File

@ -824,15 +824,15 @@ static char *PrependDir(IOR_param_t * test, char *rootDir)
sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks); sprintf(dir + i + 1, "%d", (rank + rankOffset) % test->numTasks);
/* dir doesn't exist, so create */ /* dir doesn't exist, so create */
if (backend->access(dir, F_OK, test) != 0) { if (backend->access(dir, F_OK, test->backend_options) != 0) {
if (backend->mkdir(dir, S_IRWXU, test) < 0) { if (backend->mkdir(dir, S_IRWXU, test->backend_options) < 0) {
ERRF("cannot create directory: %s", dir); ERRF("cannot create directory: %s", dir);
} }
/* check if correct permissions */ /* check if correct permissions */
} else if (backend->access(dir, R_OK, test) != 0 || } else if (backend->access(dir, R_OK, test->backend_options) != 0 ||
backend->access(dir, W_OK, test) != 0 || backend->access(dir, W_OK, test->backend_options) != 0 ||
backend->access(dir, X_OK, test) != 0) { backend->access(dir, X_OK, test->backend_options) != 0) {
ERRF("invalid directory permissions: %s", dir); ERRF("invalid directory permissions: %s", dir);
} }
@ -919,24 +919,24 @@ static void RemoveFile(char *testFileName, int filePerProc, IOR_param_t * test)
rankOffset = 0; rankOffset = 0;
GetTestFileName(testFileName, test); 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) { if (verbose >= VERBOSE_3) {
fprintf(out_logfile, "task %d removing %s\n", rank, fprintf(out_logfile, "task %d removing %s\n", rank,
testFileName); testFileName);
} }
backend->delete(testFileName, test); backend->delete(testFileName, test->backend_options);
} }
if (test->reorderTasksRandom == TRUE) { if (test->reorderTasksRandom == TRUE) {
rankOffset = tmpRankOffset; rankOffset = tmpRankOffset;
GetTestFileName(testFileName, test); GetTestFileName(testFileName, test);
} }
} else { } 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) { if (verbose >= VERBOSE_3) {
fprintf(out_logfile, "task %d removing %s\n", rank, fprintf(out_logfile, "task %d removing %s\n", rank,
testFileName); 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), MPI_CHECK(MPI_Barrier(testComm),
"barrier error"); "barrier error");
timer[4] = GetTimeStamp(); timer[4] = GetTimeStamp();
backend->close(fd, params); backend->close(fd, params->backend_options);
timer[5] = GetTimeStamp(); timer[5] = GetTimeStamp();
MPI_CHECK(MPI_Barrier(testComm), "barrier error"); MPI_CHECK(MPI_Barrier(testComm), "barrier error");
/* get the size of the file just written */ /* get the size of the file just written */
results[rep].write.aggFileSizeFromStat = 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, /* check if stat() of file doesn't equal expected file size,
use actual amount of byte moved */ use actual amount of byte moved */
@ -1412,9 +1412,9 @@ static void TestIoSys(IOR_test_t *test)
GetTestFileName(testFileName, params); GetTestFileName(testFileName, params);
params->open = WRITECHECK; 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); dataMoved = WriteOrRead(params, &results[rep], fd, WRITECHECK, &ioBuffers);
backend->close(fd, params); backend->close(fd, params->backend_options);
rankOffset = 0; rankOffset = 0;
} }
/* /*
@ -1484,7 +1484,7 @@ static void TestIoSys(IOR_test_t *test)
MPI_CHECK(MPI_Barrier(testComm), "barrier error"); MPI_CHECK(MPI_Barrier(testComm), "barrier error");
params->open = READ; params->open = READ;
timer[0] = GetTimeStamp(); timer[0] = GetTimeStamp();
fd = backend->open(testFileName, IOR_RDONLY, params); fd = backend->open(testFileName, IOR_RDONLY, params->backend_options);
timer[1] = GetTimeStamp(); timer[1] = GetTimeStamp();
if (params->intraTestBarriers) if (params->intraTestBarriers)
MPI_CHECK(MPI_Barrier(testComm), MPI_CHECK(MPI_Barrier(testComm),
@ -1501,12 +1501,12 @@ static void TestIoSys(IOR_test_t *test)
MPI_CHECK(MPI_Barrier(testComm), MPI_CHECK(MPI_Barrier(testComm),
"barrier error"); "barrier error");
timer[4] = GetTimeStamp(); timer[4] = GetTimeStamp();
backend->close(fd, params); backend->close(fd, params->backend_options);
timer[5] = GetTimeStamp(); timer[5] = GetTimeStamp();
/* get the size of the file just read */ /* get the size of the file just read */
results[rep].read.aggFileSizeFromStat = results[rep].read.aggFileSizeFromStat =
backend->get_file_size(params, testComm, backend->get_file_size(params->backend_options, testComm,
testFileName); testFileName);
/* check if stat() of file doesn't equal expected file size, /* 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); nanosleep( & wait, NULL);
} }
} else if (access == READ) { } else if (access == READ) {
amtXferred = amtXferred = backend->xfer(access, fd, buffer, transfer, test->backend_options);
backend->xfer(access, fd, buffer, transfer, test);
if (amtXferred != transfer) if (amtXferred != transfer)
ERR("cannot read from file"); ERR("cannot read from file");
if (test->interIODelay > 0){ 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); 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) if (amtXferred != transfer)
ERR("cannot read from file write check"); ERR("cannot read from file write check");
(*transferCount)++; (*transferCount)++;
@ -1834,7 +1833,7 @@ static IOR_offset_t WriteOrReadSingle(IOR_offset_t pairCnt, IOR_offset_t *offset
} else if (access == READCHECK) { } else if (access == READCHECK) {
memset(checkBuffer, 'a', transfer); 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){ if (amtXferred != transfer){
ERR("cannot read from file"); ERR("cannot read from file");
} }
@ -1931,7 +1930,7 @@ static IOR_offset_t WriteOrRead(IOR_param_t *test, IOR_results_t *results,
free(offsetArray); free(offsetArray);
if (access == WRITE && test->fsync == TRUE) { 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); return (dataMoved);
} }

View File

@ -94,6 +94,7 @@ typedef struct
char * options; /* options string */ char * options; /* options string */
// intermediate options // intermediate options
int collective; /* collective I/O */ 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 dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */
int numTasks; /* number of tasks for test */ int numTasks; /* number of tasks for test */
int numNodes; /* number of nodes for test */ int numNodes; /* number of nodes for test */
@ -155,11 +156,6 @@ typedef struct
int fsyncPerWrite; /* fsync() after each write */ int fsyncPerWrite; /* fsync() after each write */
int fsync; /* fsync() after 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 */ /* HDFS variables */
char * hdfs_user; /* copied from ENV, for now */ char * hdfs_user; /* copied from ENV, for now */
const char* hdfs_name_node; const char* hdfs_name_node;

View File

@ -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 directory does not exist, create it */
if ((rank < path_count) && backend->access(testdirpath, F_OK, &param) != 0) { if ((rank < path_count) && backend->access(testdirpath, F_OK, backend_options) != 0) {
if (backend->mkdir(testdirpath, DIRMODE, &param) != 0) { if (backend->mkdir(testdirpath, DIRMODE, backend_options) != 0) {
FAIL("Unable to create test directory path %s", testdirpath); FAIL("Unable to create test directory path %s", testdirpath);
} }
} }

View File

@ -23,10 +23,12 @@ typedef struct{
void * variable; void * variable;
} option_help; } option_help;
typedef struct airori_mod_opt_t airori_mod_opt_t;
typedef struct{ typedef struct{
char * prefix; // may be NULL to include it in the standard name char * prefix; // may be NULL to include it in the standard name
option_help * options; 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; } option_module;
typedef struct{ typedef struct{