Merge pull request #238 from jyvet/feature-cleanup-aiori
aiori-IME: Update to new aiori interfacemaster
commit
b056226077
255
src/aiori-IME.c
255
src/aiori-IME.c
|
@ -30,63 +30,70 @@
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "ime_native.h"
|
#include "ime_native.h"
|
||||||
|
|
||||||
|
#define IME_UNUSED(x) (void)(x) /* Silence compiler warnings */
|
||||||
|
|
||||||
#ifndef O_BINARY /* Required on Windows */
|
#ifndef O_BINARY /* Required on Windows */
|
||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************** P R O T O T Y P E S *****************************/
|
/**************************** P R O T O T Y P E S *****************************/
|
||||||
|
|
||||||
static void *IME_Create(char *, IOR_param_t *);
|
aiori_fd_t *IME_Create(char *, int, aiori_mod_opt_t *);
|
||||||
static void *IME_Open(char *, IOR_param_t *);
|
aiori_fd_t *IME_Open(char *, int, aiori_mod_opt_t *);
|
||||||
static void IME_Close(void *, IOR_param_t *);
|
void IME_Close(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
static void IME_Delete(char *, IOR_param_t *);
|
void IME_Delete(char *, aiori_mod_opt_t *);
|
||||||
static char *IME_GetVersion();
|
char *IME_GetVersion();
|
||||||
static void IME_Fsync(void *, IOR_param_t *);
|
void IME_Fsync(aiori_fd_t *, aiori_mod_opt_t *);
|
||||||
static int IME_Access(const char *, int, IOR_param_t *);
|
int IME_Access(const char *, int, aiori_mod_opt_t *);
|
||||||
static IOR_offset_t IME_GetFileSize(IOR_param_t *, MPI_Comm, char *);
|
IOR_offset_t IME_GetFileSize(aiori_mod_opt_t *, char *);
|
||||||
static IOR_offset_t IME_Xfer(int, void *, IOR_size_t *,
|
IOR_offset_t IME_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t,
|
||||||
IOR_offset_t, IOR_param_t *);
|
IOR_offset_t, aiori_mod_opt_t *);
|
||||||
static int IME_StatFS(const char *, ior_aiori_statfs_t *,
|
int IME_Statfs(const char *, ior_aiori_statfs_t *,
|
||||||
IOR_param_t *);
|
aiori_mod_opt_t *);
|
||||||
static int IME_RmDir(const char *, IOR_param_t *);
|
int IME_Rmdir(const char *, aiori_mod_opt_t *);
|
||||||
static int IME_MkDir(const char *, mode_t, IOR_param_t *);
|
int IME_Mkdir(const char *, mode_t, aiori_mod_opt_t *);
|
||||||
static int IME_Stat(const char *, struct stat *, IOR_param_t *);
|
int IME_Stat(const char *, struct stat *, aiori_mod_opt_t *);
|
||||||
|
void IME_Xferhints(aiori_xfer_hint_t *params);
|
||||||
|
|
||||||
#if (IME_NATIVE_API_VERSION >= 132)
|
#if (IME_NATIVE_API_VERSION >= 132)
|
||||||
static int IME_Mknod(char *);
|
int IME_Mknod(char *);
|
||||||
static void IME_Sync(IOR_param_t *);
|
void IME_Sync(aiori_mod_opt_t *param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void IME_Initialize();
|
void IME_Initialize();
|
||||||
static void IME_Finalize();
|
void IME_Finalize();
|
||||||
|
|
||||||
|
|
||||||
/************************** O P T I O N S *****************************/
|
|
||||||
|
/****************************** O P T I O N S *********************************/
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
int direct_io;
|
int direct_io;
|
||||||
} ime_options_t;
|
} ime_options_t;
|
||||||
|
|
||||||
|
option_help *IME_Options(aiori_mod_opt_t **init_backend_options,
|
||||||
|
aiori_mod_opt_t *init_values)
|
||||||
|
{
|
||||||
|
ime_options_t *o = malloc(sizeof(ime_options_t));
|
||||||
|
|
||||||
option_help * IME_options(void ** init_backend_options, void * init_values){
|
if (init_values != NULL)
|
||||||
ime_options_t * o = malloc(sizeof(ime_options_t));
|
|
||||||
|
|
||||||
if (init_values != NULL){
|
|
||||||
memcpy(o, init_values, sizeof(ime_options_t));
|
memcpy(o, init_values, sizeof(ime_options_t));
|
||||||
}else{
|
else
|
||||||
o->direct_io = 0;
|
o->direct_io = 0;
|
||||||
}
|
|
||||||
|
|
||||||
*init_backend_options = o;
|
*init_backend_options = (aiori_mod_opt_t*)o;
|
||||||
|
|
||||||
option_help h [] = {
|
option_help h[] = {
|
||||||
{0, "ime.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io},
|
{0, "ime.odirect", "Direct I/O Mode", OPTION_FLAG, 'd', & o->direct_io},
|
||||||
LAST_OPTION
|
LAST_OPTION
|
||||||
};
|
};
|
||||||
option_help * help = malloc(sizeof(h));
|
option_help *help = malloc(sizeof(h));
|
||||||
memcpy(help, h, sizeof(h));
|
memcpy(help, h, sizeof(h));
|
||||||
|
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************** D E C L A R A T I O N S ***************************/
|
/************************** D E C L A R A T I O N S ***************************/
|
||||||
|
|
||||||
extern int rank;
|
extern int rank;
|
||||||
|
@ -100,19 +107,20 @@ ior_aiori_t ime_aiori = {
|
||||||
.create = IME_Create,
|
.create = IME_Create,
|
||||||
.open = IME_Open,
|
.open = IME_Open,
|
||||||
.xfer = IME_Xfer,
|
.xfer = IME_Xfer,
|
||||||
|
.xfer_hints = IME_Xferhints,
|
||||||
.close = IME_Close,
|
.close = IME_Close,
|
||||||
.delete = IME_Delete,
|
.delete = IME_Delete,
|
||||||
.get_version = IME_GetVersion,
|
.get_version = IME_GetVersion,
|
||||||
.fsync = IME_Fsync,
|
.fsync = IME_Fsync,
|
||||||
.get_file_size = IME_GetFileSize,
|
.get_file_size = IME_GetFileSize,
|
||||||
.access = IME_Access,
|
.access = IME_Access,
|
||||||
.statfs = IME_StatFS,
|
.statfs = IME_Statfs,
|
||||||
.rmdir = IME_RmDir,
|
.rmdir = IME_Rmdir,
|
||||||
.mkdir = IME_MkDir,
|
.mkdir = IME_Mkdir,
|
||||||
.stat = IME_Stat,
|
.stat = IME_Stat,
|
||||||
.initialize = IME_Initialize,
|
.initialize = IME_Initialize,
|
||||||
.finalize = IME_Finalize,
|
.finalize = IME_Finalize,
|
||||||
.get_options = IME_options,
|
.get_options = IME_Options,
|
||||||
#if (IME_NATIVE_API_VERSION >= 132)
|
#if (IME_NATIVE_API_VERSION >= 132)
|
||||||
.sync = IME_Sync,
|
.sync = IME_Sync,
|
||||||
.mknod = IME_Mknod,
|
.mknod = IME_Mknod,
|
||||||
|
@ -120,30 +128,48 @@ ior_aiori_t ime_aiori = {
|
||||||
.enable_mdtest = true,
|
.enable_mdtest = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static aiori_xfer_hint_t *hints = NULL;
|
||||||
|
static bool ime_initialized = false;
|
||||||
|
|
||||||
|
|
||||||
/***************************** F U N C T I O N S ******************************/
|
/***************************** F U N C T I O N S ******************************/
|
||||||
|
|
||||||
|
void IME_Xferhints(aiori_xfer_hint_t *params)
|
||||||
|
{
|
||||||
|
hints = params;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize IME (before MPI is started).
|
* Initialize IME (before MPI is started).
|
||||||
*/
|
*/
|
||||||
static void IME_Initialize()
|
void IME_Initialize()
|
||||||
{
|
{
|
||||||
|
if (ime_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
ime_native_init();
|
ime_native_init();
|
||||||
|
ime_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finlize IME (after MPI is shutdown).
|
* Finlize IME (after MPI is shutdown).
|
||||||
*/
|
*/
|
||||||
static void IME_Finalize()
|
void IME_Finalize()
|
||||||
{
|
{
|
||||||
|
if (!ime_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
(void)ime_native_finalize();
|
(void)ime_native_finalize();
|
||||||
|
ime_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to access a file through the IME interface.
|
* Try to access a file through the IME interface.
|
||||||
*/
|
*/
|
||||||
static int IME_Access(const char *path, int mode, IOR_param_t *param)
|
|
||||||
|
int IME_Access(const char *path, int mode, aiori_mod_opt_t *module_options)
|
||||||
{
|
{
|
||||||
(void)param;
|
IME_UNUSED(module_options);
|
||||||
|
|
||||||
return ime_native_access(path, mode);
|
return ime_native_access(path, mode);
|
||||||
}
|
}
|
||||||
|
@ -151,41 +177,43 @@ static int IME_Access(const char *path, int mode, IOR_param_t *param)
|
||||||
/*
|
/*
|
||||||
* Creat and open a file through the IME interface.
|
* Creat and open a file through the IME interface.
|
||||||
*/
|
*/
|
||||||
static void *IME_Create(char *testFileName, IOR_param_t *param)
|
aiori_fd_t *IME_Create(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
return IME_Open(testFileName, param);
|
return IME_Open(testFileName, flags, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a file through the IME interface.
|
* Open a file through the IME interface.
|
||||||
*/
|
*/
|
||||||
static void *IME_Open(char *testFileName, IOR_param_t *param)
|
aiori_fd_t *IME_Open(char *testFileName, int flags, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
int fd_oflag = O_BINARY;
|
int fd_oflag = O_BINARY;
|
||||||
int *fd;
|
int *fd;
|
||||||
|
|
||||||
|
if (hints->dryRun)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
fd = (int *)malloc(sizeof(int));
|
fd = (int *)malloc(sizeof(int));
|
||||||
if (fd == NULL)
|
if (fd == NULL)
|
||||||
ERR("Unable to malloc file descriptor");
|
ERR("Unable to malloc file descriptor");
|
||||||
|
|
||||||
ime_options_t * o = (ime_options_t*) param->backend_options;
|
ime_options_t *o = (ime_options_t*) param;
|
||||||
if (o->direct_io == TRUE){
|
if (o->direct_io == TRUE)
|
||||||
set_o_direct_flag(&fd_oflag);
|
set_o_direct_flag(&fd_oflag);
|
||||||
}
|
|
||||||
|
|
||||||
if (param->openFlags & IOR_RDONLY)
|
if (flags & IOR_RDONLY)
|
||||||
fd_oflag |= O_RDONLY;
|
fd_oflag |= O_RDONLY;
|
||||||
if (param->openFlags & IOR_WRONLY)
|
if (flags & IOR_WRONLY)
|
||||||
fd_oflag |= O_WRONLY;
|
fd_oflag |= O_WRONLY;
|
||||||
if (param->openFlags & IOR_RDWR)
|
if (flags & IOR_RDWR)
|
||||||
fd_oflag |= O_RDWR;
|
fd_oflag |= O_RDWR;
|
||||||
if (param->openFlags & IOR_APPEND)
|
if (flags & IOR_APPEND)
|
||||||
fd_oflag |= O_APPEND;
|
fd_oflag |= O_APPEND;
|
||||||
if (param->openFlags & IOR_CREAT)
|
if (flags & IOR_CREAT)
|
||||||
fd_oflag |= O_CREAT;
|
fd_oflag |= O_CREAT;
|
||||||
if (param->openFlags & IOR_EXCL)
|
if (flags & IOR_EXCL)
|
||||||
fd_oflag |= O_EXCL;
|
fd_oflag |= O_EXCL;
|
||||||
if (param->openFlags & IOR_TRUNC)
|
if (flags & IOR_TRUNC)
|
||||||
fd_oflag |= O_TRUNC;
|
fd_oflag |= O_TRUNC;
|
||||||
|
|
||||||
*fd = ime_native_open(testFileName, fd_oflag, 0664);
|
*fd = ime_native_open(testFileName, fd_oflag, 0664);
|
||||||
|
@ -194,14 +222,14 @@ static void *IME_Open(char *testFileName, IOR_param_t *param)
|
||||||
ERR("cannot open file");
|
ERR("cannot open file");
|
||||||
}
|
}
|
||||||
|
|
||||||
return((void *)fd);
|
return (aiori_fd_t*) fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write or read access to file using the IM interface.
|
* Write or read access to file using the IM interface.
|
||||||
*/
|
*/
|
||||||
static IOR_offset_t IME_Xfer(int access, void *file, IOR_size_t *buffer,
|
IOR_offset_t IME_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer,
|
||||||
IOR_offset_t length, IOR_param_t *param)
|
IOR_offset_t length, IOR_offset_t offset, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
int xferRetries = 0;
|
int xferRetries = 0;
|
||||||
long long remaining = (long long)length;
|
long long remaining = (long long)length;
|
||||||
|
@ -209,25 +237,28 @@ static IOR_offset_t IME_Xfer(int access, void *file, IOR_size_t *buffer,
|
||||||
int fd = *(int *)file;
|
int fd = *(int *)file;
|
||||||
long long rc;
|
long long rc;
|
||||||
|
|
||||||
|
if (hints->dryRun)
|
||||||
|
return length;
|
||||||
|
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
/* write/read file */
|
/* write/read file */
|
||||||
if (access == WRITE) { /* WRITE */
|
if (access == WRITE) { /* WRITE */
|
||||||
if (verbose >= VERBOSE_4) {
|
if (verbose >= VERBOSE_4) {
|
||||||
fprintf(stdout, "task %d writing to offset %lld\n",
|
fprintf(stdout, "task %d writing to offset %lld\n",
|
||||||
rank, param->offset + length - remaining);
|
rank, offset + length - remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ime_native_pwrite(fd, ptr, remaining, param->offset);
|
rc = ime_native_pwrite(fd, ptr, remaining, offset);
|
||||||
|
|
||||||
if (param->fsyncPerWrite)
|
if (hints->fsyncPerWrite)
|
||||||
IME_Fsync(&fd, param);
|
IME_Fsync(file, param);
|
||||||
} else { /* READ or CHECK */
|
} else { /* READ or CHECK */
|
||||||
if (verbose >= VERBOSE_4) {
|
if (verbose >= VERBOSE_4) {
|
||||||
fprintf(stdout, "task %d reading from offset %lld\n",
|
fprintf(stdout, "task %d reading from offset %lld\n",
|
||||||
rank, param->offset + length - remaining);
|
rank, offset + length - remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ime_native_pread(fd, ptr, remaining, param->offset);
|
rc = ime_native_pread(fd, ptr, remaining, offset);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
ERR("hit EOF prematurely");
|
ERR("hit EOF prematurely");
|
||||||
else if (rc < 0)
|
else if (rc < 0)
|
||||||
|
@ -238,9 +269,9 @@ static IOR_offset_t IME_Xfer(int access, void *file, IOR_size_t *buffer,
|
||||||
fprintf(stdout, "WARNING: Task %d, partial %s, %lld of "
|
fprintf(stdout, "WARNING: Task %d, partial %s, %lld of "
|
||||||
"%lld bytes at offset %lld\n",
|
"%lld bytes at offset %lld\n",
|
||||||
rank, access == WRITE ? "write" : "read", rc,
|
rank, access == WRITE ? "write" : "read", rc,
|
||||||
remaining, param->offset + length - remaining );
|
remaining, offset + length - remaining );
|
||||||
|
|
||||||
if (param->singleXferAttempt) {
|
if (hints->singleXferAttempt) {
|
||||||
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
|
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1),
|
||||||
"barrier error");
|
"barrier error");
|
||||||
}
|
}
|
||||||
|
@ -264,7 +295,7 @@ static IOR_offset_t IME_Xfer(int access, void *file, IOR_size_t *buffer,
|
||||||
/*
|
/*
|
||||||
* Perform fsync().
|
* Perform fsync().
|
||||||
*/
|
*/
|
||||||
static void IME_Fsync(void *fd, IOR_param_t *param)
|
void IME_Fsync(aiori_fd_t *fd, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
if (ime_native_fsync(*(int *)fd) != 0)
|
if (ime_native_fsync(*(int *)fd) != 0)
|
||||||
WARN("cannot perform fsync on file");
|
WARN("cannot perform fsync on file");
|
||||||
|
@ -273,33 +304,34 @@ static void IME_Fsync(void *fd, IOR_param_t *param)
|
||||||
/*
|
/*
|
||||||
* Close a file through the IME interface.
|
* Close a file through the IME interface.
|
||||||
*/
|
*/
|
||||||
static void IME_Close(void *fd, IOR_param_t *param)
|
void IME_Close(aiori_fd_t *file, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
if (ime_native_close(*(int *)fd) != 0)
|
if (hints->dryRun)
|
||||||
{
|
return;
|
||||||
free(fd);
|
|
||||||
ERR("cannot close file");
|
if (ime_native_close(*(int*)file) != 0)
|
||||||
}
|
ERRF("Cannot close file descriptor: %d", *(int*)file);
|
||||||
else
|
|
||||||
free(fd);
|
free(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete a file through the IME interface.
|
* Delete a file through the IME interface.
|
||||||
*/
|
*/
|
||||||
static void IME_Delete(char *testFileName, IOR_param_t *param)
|
void IME_Delete(char *testFileName, aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
char errmsg[256];
|
if (hints->dryRun)
|
||||||
sprintf(errmsg, "[RANK %03d]:cannot delete file %s\n",
|
return;
|
||||||
rank, testFileName);
|
|
||||||
if (ime_native_unlink(testFileName) != 0)
|
if (ime_native_unlink(testFileName) != 0)
|
||||||
WARN(errmsg);
|
EWARNF("[RANK %03d]: cannot delete file \"%s\"\n",
|
||||||
|
rank, testFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine API version.
|
* Determine API version.
|
||||||
*/
|
*/
|
||||||
static char *IME_GetVersion()
|
char *IME_GetVersion()
|
||||||
{
|
{
|
||||||
static char ver[1024] = {};
|
static char ver[1024] = {};
|
||||||
#if (IME_NATIVE_API_VERSION >= 120)
|
#if (IME_NATIVE_API_VERSION >= 120)
|
||||||
|
@ -310,10 +342,10 @@ static char *IME_GetVersion()
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IME_StatFS(const char *path, ior_aiori_statfs_t *stat_buf,
|
int IME_Statfs(const char *path, ior_aiori_statfs_t *stat_buf,
|
||||||
IOR_param_t *param)
|
aiori_mod_opt_t *module_options)
|
||||||
{
|
{
|
||||||
(void)param;
|
IME_UNUSED(module_options);
|
||||||
|
|
||||||
#if (IME_NATIVE_API_VERSION >= 130)
|
#if (IME_NATIVE_API_VERSION >= 130)
|
||||||
struct statvfs statfs_buf;
|
struct statvfs statfs_buf;
|
||||||
|
@ -321,7 +353,6 @@ static int IME_StatFS(const char *path, ior_aiori_statfs_t *stat_buf,
|
||||||
int ret = ime_native_statvfs(path, &statfs_buf);
|
int ret = ime_native_statvfs(path, &statfs_buf);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
stat_buf->f_bsize = statfs_buf.f_bsize;
|
stat_buf->f_bsize = statfs_buf.f_bsize;
|
||||||
stat_buf->f_blocks = statfs_buf.f_blocks;
|
stat_buf->f_blocks = statfs_buf.f_blocks;
|
||||||
stat_buf->f_bfree = statfs_buf.f_bfree;
|
stat_buf->f_bfree = statfs_buf.f_bfree;
|
||||||
|
@ -330,38 +361,37 @@ static int IME_StatFS(const char *path, ior_aiori_statfs_t *stat_buf,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
(void)path;
|
IME_UNUSED(path);
|
||||||
(void)stat_buf;
|
IME_UNUSED(stat_buf);
|
||||||
|
|
||||||
WARN("statfs is currently not supported in IME backend!");
|
WARN("statfs is currently not supported in IME backend!");
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int IME_Mkdir(const char *path, mode_t mode, aiori_mod_opt_t * module_options)
|
||||||
static int IME_MkDir(const char *path, mode_t mode, IOR_param_t *param)
|
|
||||||
{
|
{
|
||||||
(void)param;
|
IME_UNUSED(module_options);
|
||||||
|
|
||||||
#if (IME_NATIVE_API_VERSION >= 130)
|
#if (IME_NATIVE_API_VERSION >= 130)
|
||||||
return ime_native_mkdir(path, mode);
|
return ime_native_mkdir(path, mode);
|
||||||
#else
|
#else
|
||||||
(void)path;
|
IME_UNUSED(path);
|
||||||
(void)mode;
|
IME_UNUSED(mode);
|
||||||
|
|
||||||
WARN("mkdir not supported in IME backend!");
|
WARN("mkdir not supported in IME backend!");
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IME_RmDir(const char *path, IOR_param_t *param)
|
int IME_Rmdir(const char *path, aiori_mod_opt_t *module_options)
|
||||||
{
|
{
|
||||||
(void)param;
|
IME_UNUSED(module_options);
|
||||||
|
|
||||||
#if (IME_NATIVE_API_VERSION >= 130)
|
#if (IME_NATIVE_API_VERSION >= 130)
|
||||||
return ime_native_rmdir(path);
|
return ime_native_rmdir(path);
|
||||||
#else
|
#else
|
||||||
(void)path;
|
IME_UNUSED(path);
|
||||||
|
|
||||||
WARN("rmdir not supported in IME backend!");
|
WARN("rmdir not supported in IME backend!");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -371,9 +401,10 @@ static int IME_RmDir(const char *path, IOR_param_t *param)
|
||||||
/*
|
/*
|
||||||
* Perform stat() through the IME interface.
|
* Perform stat() through the IME interface.
|
||||||
*/
|
*/
|
||||||
static int IME_Stat(const char *path, struct stat *buf, IOR_param_t *param)
|
int IME_Stat(const char *path, struct stat *buf,
|
||||||
|
aiori_mod_opt_t *module_options)
|
||||||
{
|
{
|
||||||
(void)param;
|
IME_UNUSED(module_options);
|
||||||
|
|
||||||
return ime_native_stat(path, buf);
|
return ime_native_stat(path, buf);
|
||||||
}
|
}
|
||||||
|
@ -381,47 +412,25 @@ static int IME_Stat(const char *path, struct stat *buf, IOR_param_t *param)
|
||||||
/*
|
/*
|
||||||
* Use IME stat() to return aggregate file size.
|
* Use IME stat() to return aggregate file size.
|
||||||
*/
|
*/
|
||||||
static IOR_offset_t IME_GetFileSize(IOR_param_t *test, MPI_Comm testComm,
|
IOR_offset_t IME_GetFileSize(aiori_mod_opt_t *test, char *testFileName)
|
||||||
char *testFileName)
|
|
||||||
{
|
{
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
|
|
||||||
|
|
||||||
if (ime_native_stat(testFileName, &stat_buf) != 0) {
|
if (hints->dryRun)
|
||||||
ERR("cannot get status of written file");
|
return 0;
|
||||||
}
|
|
||||||
aggFileSizeFromStat = stat_buf.st_size;
|
|
||||||
|
|
||||||
if (test->filePerProc) {
|
if (ime_native_stat(testFileName, &stat_buf) != 0)
|
||||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1,
|
ERRF("cannot get status of written file %s",
|
||||||
MPI_LONG_LONG_INT, MPI_SUM, testComm),
|
testFileName);
|
||||||
"cannot total data moved");
|
|
||||||
aggFileSizeFromStat = tmpSum;
|
|
||||||
} else {
|
|
||||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMin, 1,
|
|
||||||
MPI_LONG_LONG_INT, MPI_MIN, testComm),
|
|
||||||
"cannot total data moved");
|
|
||||||
MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMax, 1,
|
|
||||||
MPI_LONG_LONG_INT, MPI_MAX, testComm),
|
|
||||||
"cannot total data moved");
|
|
||||||
|
|
||||||
if (tmpMin != tmpMax) {
|
return stat_buf.st_size;
|
||||||
if (rank == 0) {
|
|
||||||
WARN("inconsistent file size by different tasks");
|
|
||||||
}
|
|
||||||
/* incorrect, but now consistent across tasks */
|
|
||||||
aggFileSizeFromStat = tmpMin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(aggFileSizeFromStat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (IME_NATIVE_API_VERSION >= 132)
|
#if (IME_NATIVE_API_VERSION >= 132)
|
||||||
/*
|
/*
|
||||||
* Create a file through mknod interface.
|
* Create a file through mknod interface.
|
||||||
*/
|
*/
|
||||||
static int IME_Mknod(char *testFileName)
|
int IME_Mknod(char *testFileName)
|
||||||
{
|
{
|
||||||
int ret = ime_native_mknod(testFileName, S_IFREG | S_IRUSR, 0);
|
int ret = ime_native_mknod(testFileName, S_IFREG | S_IRUSR, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -433,7 +442,7 @@ static int IME_Mknod(char *testFileName)
|
||||||
/*
|
/*
|
||||||
* Use IME sync to flush page cache of all opened files.
|
* Use IME sync to flush page cache of all opened files.
|
||||||
*/
|
*/
|
||||||
static void IME_Sync(IOR_param_t * param)
|
void IME_Sync(aiori_mod_opt_t *param)
|
||||||
{
|
{
|
||||||
int ret = ime_native_sync(0);
|
int ret = ime_native_sync(0);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
|
Loading…
Reference in New Issue