31 #include "ime_native.h" 33 #define IME_UNUSED(x) (void)(x) 58 #if (IME_NATIVE_API_VERSION >= 132) 59 int IME_Mknod(
char *);
77 if (init_values !=
NULL)
89 memcpy(help, h,
sizeof(h));
122 #if (IME_NATIVE_API_VERSION >= 132) 126 .enable_mdtest =
true,
160 (void)ime_native_finalize();
172 return ime_native_access(path, mode);
180 return IME_Open(testFileName, flags, param);
194 fd = (
int *)malloc(
sizeof(
int));
196 ERR(
"Unable to malloc file descriptor");
203 fd_oflag |= O_RDONLY;
205 fd_oflag |= O_WRONLY;
209 fd_oflag |= O_APPEND;
217 *fd = ime_native_open(testFileName, fd_oflag, 0664);
220 ERR(
"cannot open file");
233 long long remaining = (
long long)length;
234 char *ptr = (
char *)buffer;
235 int fd = *(
int *)file;
241 while (remaining > 0) {
243 if (access ==
WRITE) {
245 fprintf(stdout,
"task %d writing to offset %lld\n",
246 rank, offset + length - remaining);
249 rc = ime_native_pwrite(fd, ptr, remaining, offset);
255 fprintf(stdout,
"task %d reading from offset %lld\n",
256 rank, offset + length - remaining);
259 rc = ime_native_pread(fd, ptr, remaining, offset);
261 ERR(
"hit EOF prematurely");
266 if (rc < remaining) {
267 fprintf(stdout,
"WARNING: Task %d, partial %s, %lld of " 268 "%lld bytes at offset %lld\n",
269 rank, access ==
WRITE ?
"write" :
"read", rc,
270 remaining, offset + length - remaining );
278 ERR(
"too many retries -- aborting" );
280 }
else if (rc > remaining)
281 ERR(
"too many bytes transferred!?!");
284 assert(rc <= remaining);
298 if (ime_native_fsync(*(
int *)fd) != 0)
299 WARN(
"cannot perform fsync on file");
310 if (ime_native_close(*(
int*)file) != 0)
311 ERRF(
"Cannot close file descriptor: %d", *(
int*)file);
324 if (ime_native_unlink(testFileName) != 0)
325 EWARNF(
"[RANK %03d]: cannot delete file \"%s\"\n",
334 static char ver[1024] = {};
335 #if (IME_NATIVE_API_VERSION >= 120) 336 strcpy(ver, ime_native_version());
338 strcpy(ver,
"not supported");
348 #if (IME_NATIVE_API_VERSION >= 130) 349 struct statvfs statfs_buf;
351 int ret = ime_native_statvfs(path, &statfs_buf);
354 stat_buf->
f_bsize = statfs_buf.f_bsize;
355 stat_buf->
f_blocks = statfs_buf.f_blocks;
356 stat_buf->
f_bfree = statfs_buf.f_bfree;
357 stat_buf->
f_files = statfs_buf.f_files;
358 stat_buf->
f_ffree = statfs_buf.f_ffree;
365 WARN(
"statfs is currently not supported in IME backend!");
374 #if (IME_NATIVE_API_VERSION >= 130) 375 return ime_native_mkdir(path, mode);
380 WARN(
"mkdir not supported in IME backend!");
389 #if (IME_NATIVE_API_VERSION >= 130) 390 return ime_native_rmdir(path);
394 WARN(
"rmdir not supported in IME backend!");
407 return ime_native_stat(path, buf);
415 struct stat stat_buf;
420 if (ime_native_stat(testFileName, &stat_buf) != 0)
421 ERRF(
"cannot get status of written file %s",
423 return stat_buf.st_size;
426 #if (IME_NATIVE_API_VERSION >= 132) 430 int IME_Mknod(
char *testFileName)
432 int ret = ime_native_mknod(testFileName, S_IFREG | S_IRUSR, 0);
444 int ret = ime_native_sync(0);
446 FAIL(
"Error executing the sync command.");
static aiori_xfer_hint_t * hints
option_help * IME_Options(aiori_mod_opt_t **init_backend_options, aiori_mod_opt_t *init_values)
struct benchmark_options o
int IME_Rmdir(const char *, aiori_mod_opt_t *)
int IME_Stat(const char *, struct stat *, aiori_mod_opt_t *)
#define MPI_CHECK(MPI_STATUS, MSG)
static bool ime_initialized
void IME_Close(aiori_fd_t *, aiori_mod_opt_t *)
int IME_Statfs(const char *, ior_aiori_statfs_t *, aiori_mod_opt_t *)
#define EWARNF(FORMAT,...)
IOR_offset_t IME_Xfer(int, aiori_fd_t *, IOR_size_t *, IOR_offset_t, IOR_offset_t, aiori_mod_opt_t *)
int IME_Mkdir(const char *, mode_t, aiori_mod_opt_t *)
aiori_fd_t * IME_Open(char *, int, aiori_mod_opt_t *)
int IME_Access(const char *, int, aiori_mod_opt_t *)
IOR_offset_t IME_GetFileSize(aiori_mod_opt_t *, char *)
aiori_fd_t * IME_Create(char *, int, aiori_mod_opt_t *)
void set_o_direct_flag(int *flag)
void IME_Delete(char *, aiori_mod_opt_t *)
long long int IOR_offset_t
void IME_Xferhints(aiori_xfer_hint_t *params)
void IME_Fsync(aiori_fd_t *, aiori_mod_opt_t *)