31 #include "ime_native.h" 55 #if (IME_NATIVE_API_VERSION >= 132) 56 static int IME_Mknod(
char *);
73 if (init_values !=
NULL){
79 *init_backend_options =
o;
86 memcpy(help, h,
sizeof(h));
116 #if (IME_NATIVE_API_VERSION >= 132) 120 .enable_mdtest =
true,
138 (void)ime_native_finalize();
148 return ime_native_access(path, mode);
156 return IME_Open(testFileName, param);
167 fd = (
int *)malloc(
sizeof(
int));
169 ERR(
"Unable to malloc file descriptor");
177 fd_oflag |= O_RDONLY;
179 fd_oflag |= O_WRONLY;
183 fd_oflag |= O_APPEND;
191 *fd = ime_native_open(testFileName, fd_oflag, 0664);
194 ERR(
"cannot open file");
207 long long remaining = (
long long)length;
208 char *ptr = (
char *)buffer;
209 int fd = *(
int *)file;
212 while (remaining > 0) {
214 if (access ==
WRITE) {
216 fprintf(stdout,
"task %d writing to offset %lld\n",
220 rc = ime_native_pwrite(fd, ptr, remaining, param->
offset);
226 fprintf(stdout,
"task %d reading from offset %lld\n",
230 rc = ime_native_pread(fd, ptr, remaining, param->
offset);
232 ERR(
"hit EOF prematurely");
237 if (rc < remaining) {
238 fprintf(stdout,
"WARNING: Task %d, partial %s, %lld of " 239 "%lld bytes at offset %lld\n",
240 rank, access ==
WRITE ?
"write" :
"read", rc,
241 remaining, param->
offset + length - remaining );
249 ERR(
"too many retries -- aborting" );
251 }
else if (rc > remaining)
252 ERR(
"too many bytes transferred!?!");
255 assert(rc <= remaining);
269 if (ime_native_fsync(*(
int *)fd) != 0)
270 WARN(
"cannot perform fsync on file");
278 if (ime_native_close(*(
int *)fd) != 0)
281 ERR(
"cannot close file");
293 sprintf(errmsg,
"[RANK %03d]:cannot delete file %s\n",
295 if (ime_native_unlink(testFileName) != 0)
304 static char ver[1024] = {};
305 #if (IME_NATIVE_API_VERSION >= 120) 306 strcpy(ver, ime_native_version());
308 strcpy(ver,
"not supported");
318 #if (IME_NATIVE_API_VERSION >= 130) 319 struct statvfs statfs_buf;
321 int ret = ime_native_statvfs(path, &statfs_buf);
325 stat_buf->
f_bsize = statfs_buf.f_bsize;
326 stat_buf->
f_blocks = statfs_buf.f_blocks;
327 stat_buf->
f_bfree = statfs_buf.f_bfree;
328 stat_buf->
f_files = statfs_buf.f_files;
329 stat_buf->
f_ffree = statfs_buf.f_ffree;
336 WARN(
"statfs is currently not supported in IME backend!");
346 #if (IME_NATIVE_API_VERSION >= 130) 347 return ime_native_mkdir(path, mode);
352 WARN(
"mkdir not supported in IME backend!");
361 #if (IME_NATIVE_API_VERSION >= 130) 362 return ime_native_rmdir(path);
366 WARN(
"rmdir not supported in IME backend!");
378 return ime_native_stat(path, buf);
387 struct stat stat_buf;
388 IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
390 if (ime_native_stat(testFileName, &stat_buf) != 0) {
391 ERR(
"cannot get status of written file");
393 aggFileSizeFromStat = stat_buf.st_size;
396 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpSum, 1,
397 MPI_LONG_LONG_INT, MPI_SUM, testComm),
398 "cannot total data moved");
399 aggFileSizeFromStat = tmpSum;
401 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMin, 1,
402 MPI_LONG_LONG_INT, MPI_MIN, testComm),
403 "cannot total data moved");
404 MPI_CHECK(MPI_Allreduce(&aggFileSizeFromStat, &tmpMax, 1,
405 MPI_LONG_LONG_INT, MPI_MAX, testComm),
406 "cannot total data moved");
408 if (tmpMin != tmpMax) {
410 WARN(
"inconsistent file size by different tasks");
413 aggFileSizeFromStat = tmpMin;
417 return(aggFileSizeFromStat);
420 #if (IME_NATIVE_API_VERSION >= 132) 424 static int IME_Mknod(
char *testFileName)
426 int ret = ime_native_mknod(testFileName, S_IFREG | S_IRUSR, 0);
438 int ret = ime_native_sync(0);
440 FAIL(
"Error executing the sync command.");
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 *)
option_help * IME_options(void **init_backend_options, void *init_values)
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 struct cephfs_options o
static int IME_StatFS(const char *, ior_aiori_statfs_t *, IOR_param_t *)