31 #include "ime_native.h" 98 (void)ime_native_finalize();
108 return ime_native_access(path, mode);
116 return IME_Open(testFileName, param);
127 fd = (
int *)malloc(
sizeof(
int));
129 ERR(
"Unable to malloc file descriptor");
135 fd_oflag |= O_RDONLY;
137 fd_oflag |= O_WRONLY;
141 fd_oflag |= O_APPEND;
149 *fd = ime_native_open(testFileName, fd_oflag, 0664);
152 ERR(
"cannot open file");
165 long long remaining = (
long long)length;
166 char *ptr = (
char *)buffer;
167 int fd = *(
int *)file;
170 while (remaining > 0) {
172 if (access ==
WRITE) {
174 fprintf(stdout,
"task %d writing to offset %lld\n",
178 rc = ime_native_pwrite(fd, ptr, remaining, param->
offset);
184 fprintf(stdout,
"task %d reading from offset %lld\n",
188 rc = ime_native_pread(fd, ptr, remaining, param->
offset);
190 ERR(
"hit EOF prematurely");
195 if (rc < remaining) {
196 fprintf(stdout,
"WARNING: Task %d, partial %s, %lld of " 197 "%lld bytes at offset %lld\n",
198 rank, access ==
WRITE ?
"write" :
"read", rc,
199 remaining, param->
offset + length - remaining );
207 ERR(
"too many retries -- aborting" );
209 }
else if (rc > remaining)
210 ERR(
"too many bytes transferred!?!");
213 assert(rc <= remaining);
227 if (ime_native_fsync(*(
int *)fd) != 0)
228 WARN(
"cannot perform fsync on file");
236 if (ime_native_close(*(
int *)fd) != 0)
239 ERR(
"cannot close file");
251 sprintf(errmsg,
"[RANK %03d]:cannot delete file %s\n",
253 if (ime_native_unlink(testFileName) != 0)
262 static char ver[1024] = {};
263 #if (IME_NATIVE_API_VERSION >= 120) 264 strcpy(ver, ime_native_version());
266 strcpy(ver,
"not supported");
281 WARN(
"statfs is currently not supported in IME backend!");
294 WARN(
"mkdir is currently not supported in IME backend!");
306 WARN(
"rmdir is currently not supported in IME backend!");
317 return ime_native_stat(path, buf);
326 struct stat stat_buf;
327 IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
329 if (ime_native_stat(testFileName, &stat_buf) != 0) {
330 ERR(
"cannot get status of written file");
332 aggFileSizeFromStat = stat_buf.st_size;
335 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1,
336 MPI_LONG_LONG_INT, MPI_SUM, testComm),
337 "cannot total data moved");
338 aggFileSizeFromStat = tmpSum;
340 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMin, 1,
341 MPI_LONG_LONG_INT, MPI_MIN, testComm),
342 "cannot total data moved");
343 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMax, 1,
344 MPI_LONG_LONG_INT, MPI_MAX, testComm),
345 "cannot total data moved");
347 if (tmpMin != tmpMax) {
349 WARN(
"inconsistent file size by different tasks");
352 aggFileSizeFromStat = tmpMin;
356 return(aggFileSizeFromStat);
static void * IME_Create(char *, IOR_param_t *)
static void * IME_Open(char *, IOR_param_t *)
void set_o_direct_flag(int *fd)
static void IME_Initialize()
static void IME_Fsync(void *, IOR_param_t *)
static int IME_RmDir(const char *, IOR_param_t *)
static void IME_Finalize()
static int IME_Stat(const char *, struct stat *, IOR_param_t *)
static IOR_offset_t IME_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
static int IME_Access(const char *, int, IOR_param_t *)
static void IME_Close(void *, IOR_param_t *)
#define MPI_CHECK(MPI_STATUS, MSG)
static IOR_offset_t IME_GetFileSize(IOR_param_t *, MPI_Comm, char *)
static void IME_Delete(char *, IOR_param_t *)
static int IME_MkDir(const char *, mode_t, IOR_param_t *)
long long int IOR_offset_t
static char * IME_GetVersion()
static int IME_StatFS(const char *, ior_aiori_statfs_t *, IOR_param_t *)