IOR
aiori.h
Go to the documentation of this file.
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4 /******************************************************************************\
5 * *
6 * Copyright (c) 2003, The Regents of the University of California *
7 * See the file COPYRIGHT for a complete copyright notice and license. *
8 * *
9 ********************************************************************************
10 *
11 * Definitions and prototypes of abstract I/O interface
12 *
13 \******************************************************************************/
14 
15 #ifndef _AIORI_H
16 #define _AIORI_H
17 
18 #include <sys/stat.h>
19 #include <stdbool.h>
20 
21 #include "iordef.h" /* IOR Definitions */
22 #include "aiori-debug.h"
23 #include "option.h"
24 
25 /*************************** D E F I N I T I O N S ****************************/
26 
27 /* -- file open flags -- */
28 #define IOR_RDONLY 0x01 /* read only */
29 #define IOR_WRONLY 0x02 /* write only */
30 #define IOR_RDWR 0x04 /* read/write */
31 #define IOR_APPEND 0x08 /* append */
32 #define IOR_CREAT 0x10 /* create */
33 #define IOR_TRUNC 0x20 /* truncate */
34 #define IOR_EXCL 0x40 /* exclusive */
35 #define IOR_DIRECT 0x80 /* bypass I/O buffers */
36 
37 /* -- file mode flags -- */
38 #define IOR_IRWXU 0x0001 /* read, write, execute perm: owner */
39 #define IOR_IRUSR 0x0002 /* read permission: owner */
40 #define IOR_IWUSR 0x0004 /* write permission: owner */
41 #define IOR_IXUSR 0x0008 /* execute permission: owner */
42 #define IOR_IRWXG 0x0010 /* read, write, execute perm: group */
43 #define IOR_IRGRP 0x0020 /* read permission: group */
44 #define IOR_IWGRP 0x0040 /* write permission: group */
45 #define IOR_IXGRP 0x0080 /* execute permission: group */
46 #define IOR_IRWXO 0x0100 /* read, write, execute perm: other */
47 #define IOR_IROTH 0x0200 /* read permission: other */
48 #define IOR_IWOTH 0x0400 /* write permission: other */
49 #define IOR_IXOTH 0x0800 /* execute permission: other */
50 
51 typedef struct ior_aiori_statfs {
52  uint64_t f_bsize;
53  uint64_t f_blocks;
54  uint64_t f_bfree;
55  uint64_t f_bavail;
56  uint64_t f_files;
57  uint64_t f_ffree;
59 
60 /*
61  This structure contains information about the expected IO pattern that may be used to optimize data access. Optimally, it should be stored for each file descriptor, at the moment it can only be set globally per aiori backend module.
62  */
63 typedef struct aiori_xfer_hint_t{
64  int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */
65  int filePerProc; /* single file or file-per-process */
66  int collective; /* collective I/O */
67  int numTasks; /* number of tasks for test */
68  int numNodes; /* number of nodes for test */
69  int randomOffset; /* access is to random offsets */
70  int fsyncPerWrite; /* fsync() after each write */
71  IOR_offset_t segmentCount; /* number of segments (or HDF5 datasets) */
72  IOR_offset_t blockSize; /* contiguous bytes to write per task */
73  IOR_offset_t transferSize; /* size of transfer in bytes */
74  IOR_offset_t expectedAggFileSize; /* calculated aggregate file size */
75  int singleXferAttempt; /* do not retry transfer if incomplete */
77 
78 /* this is a dummy structure to create some type safety */
80  void * dummy;
81 };
82 
83 typedef struct aiori_fd_t{
84  void * dummy;
85 } aiori_fd_t;
86 
87 typedef struct ior_aiori {
88  char *name;
89  char *name_legacy;
90  aiori_fd_t *(*create)(char *, int iorflags, aiori_mod_opt_t *);
91  int (*mknod)(char *);
92  aiori_fd_t *(*open)(char *, int iorflags, aiori_mod_opt_t *);
93  /*
94  Allow to set generic transfer options that shall be applied to any subsequent IO call.
95  */
96  void (*xfer_hints)(aiori_xfer_hint_t * params);
97  IOR_offset_t (*xfer)(int access, aiori_fd_t *, IOR_size_t *,
98  IOR_offset_t size, IOR_offset_t offset, aiori_mod_opt_t * module_options);
99  void (*close)(aiori_fd_t *, aiori_mod_opt_t * module_options);
100  void (*delete)(char *, aiori_mod_opt_t * module_options);
101  char* (*get_version)(void);
102  void (*fsync)(aiori_fd_t *, aiori_mod_opt_t * module_options);
103  IOR_offset_t (*get_file_size)(aiori_mod_opt_t * module_options, char * filename);
104  int (*statfs) (const char *, ior_aiori_statfs_t *, aiori_mod_opt_t * module_options);
105  int (*mkdir) (const char *path, mode_t mode, aiori_mod_opt_t * module_options);
106  int (*rmdir) (const char *path, aiori_mod_opt_t * module_options);
107  int (*access) (const char *path, int mode, aiori_mod_opt_t * module_options);
108  int (*stat) (const char *path, struct stat *buf, aiori_mod_opt_t * module_options);
109  void (*initialize)(aiori_mod_opt_t * options); /* called once per program before MPI is started */
110  void (*finalize)(aiori_mod_opt_t * options); /* called once per program after MPI is shutdown */
111  int (*rename) (const char *oldpath, const char *newpath, aiori_mod_opt_t * module_options);
112  option_help * (*get_options)(aiori_mod_opt_t ** init_backend_options, aiori_mod_opt_t* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */
113  int (*check_params)(aiori_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*/
114  void (*sync)(aiori_mod_opt_t * ); /* synchronize every pending operation for this storage */
116 } ior_aiori_t;
117 
121 };
122 
123 extern ior_aiori_t dummy_aiori;
124 extern ior_aiori_t aio_aiori;
125 extern ior_aiori_t daos_aiori;
126 extern ior_aiori_t dfs_aiori;
127 extern ior_aiori_t hdf5_aiori;
128 extern ior_aiori_t hdfs_aiori;
129 extern ior_aiori_t ime_aiori;
130 extern ior_aiori_t mpiio_aiori;
131 extern ior_aiori_t ncmpi_aiori;
132 extern ior_aiori_t posix_aiori;
133 extern ior_aiori_t pmdk_aiori;
134 extern ior_aiori_t mmap_aiori;
136 extern ior_aiori_t s3_4c_aiori;
139 extern ior_aiori_t rados_aiori;
141 extern ior_aiori_t gfarm_aiori;
142 
143 const ior_aiori_t *aiori_select (const char *api);
144 int aiori_count (void);
145 void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type);
147 
148 void * airoi_update_module_options(const ior_aiori_t * backend, options_all_t * module_defaults);
149 
150 const char *aiori_default (void);
151 
152 /* some generic POSIX-based backend calls */
153 char * aiori_get_version (void);
154 int aiori_posix_statfs (const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t * module_options);
155 int aiori_posix_mkdir (const char *path, mode_t mode, aiori_mod_opt_t * module_options);
156 int aiori_posix_rmdir (const char *path, aiori_mod_opt_t * module_options);
157 int aiori_posix_access (const char *path, int mode, aiori_mod_opt_t * module_options);
158 int aiori_posix_stat (const char *path, struct stat *buf, aiori_mod_opt_t * module_options);
159 
160 
161 /* NOTE: these 4 MPI-IO functions are exported for reuse by HDF5/PNetCDF */
162 void MPIIO_Delete(char *testFileName, aiori_mod_opt_t * module_options);
164 int MPIIO_Access(const char *, int, aiori_mod_opt_t * module_options);
165 void MPIIO_xfer_hints(aiori_xfer_hint_t * params);
166 
167 #endif /* not _AIORI_H */
Definition: aiori.h:120
ior_aiori_t s3_emc_aiori
Definition: aiori-S3-4c.c:217
options_all_t * airoi_create_all_module_options(option_help *global_options)
Definition: aiori.c:107
struct ior_aiori_statfs ior_aiori_statfs_t
ior_aiori_t s3_4c_aiori
Definition: aiori-S3-4c.c:178
uint64_t f_blocks
Definition: aiori.h:53
uint64_t f_bfree
Definition: aiori.h:54
IOR_offset_t segmentCount
Definition: aiori.h:71
ior_aiori_t cephfs_aiori
Definition: aiori-CEPHFS.c:83
bench_type
Definition: aiori.h:118
IOR_offset_t blockSize
Definition: aiori.h:72
ior_aiori_t pmdk_aiori
Definition: aiori-PMDK.c:53
const ior_aiori_t * aiori_select(const char *api)
Definition: aiori.c:237
void * dummy
Definition: aiori.h:80
char * aiori_get_version(void)
Definition: aiori.c:232
ior_aiori_t ime_aiori
Definition: aiori-IME.c:102
ior_aiori_t dummy_aiori
Definition: aiori-DUMMY.c:182
int aiori_posix_statfs(const char *path, ior_aiori_statfs_t *stat_buf, aiori_mod_opt_t *module_options)
Definition: aiori.c:166
ior_aiori_t rados_aiori
Definition: aiori-RADOS.c:68
uint64_t f_ffree
Definition: aiori.h:57
int aiori_count(void)
Definition: aiori.c:291
ior_aiori_t mpiio_aiori
Definition: aiori-MPIIO.c:87
IOR_offset_t expectedAggFileSize
Definition: aiori.h:74
ior_aiori_t hdfs_aiori
Definition: aiori-HDFS.c:123
IOR_offset_t MPIIO_GetFileSize(aiori_mod_opt_t *options, char *testFileName)
Definition: aiori-MPIIO.c:588
ior_aiori_t hdf5_aiori
Definition: aiori-HDF5.c:141
uint64_t f_files
Definition: aiori.h:56
static option_help options[]
Definition: aiori-CEPHFS.c:54
void MPIIO_xfer_hints(aiori_xfer_hint_t *params)
Definition: aiori-MPIIO.c:111
uint64_t f_bsize
Definition: aiori.h:52
Definition: aiori.h:119
int collective
Definition: aiori.h:66
ior_aiori_t gfarm_aiori
Definition: aiori-Gfarm.c:297
int singleXferAttempt
Definition: aiori.h:75
ior_aiori_t mmap_aiori
Definition: aiori-MMAP.c:41
Definition: ior.h:56
char * name_legacy
Definition: aiori.h:89
int aiori_posix_access(const char *path, int mode, aiori_mod_opt_t *module_options)
Definition: aiori.c:222
void MPIIO_Delete(char *testFileName, aiori_mod_opt_t *module_options)
Definition: aiori-MPIIO.c:521
void * dummy
Definition: aiori.h:84
IOR_offset_t transferSize
Definition: aiori.h:73
static const ior_aiori_t * backend
Definition: ior.c:53
static options_all_t * global_options
Definition: parse_options.c:41
long long int IOR_size_t
Definition: iordef.h:110
int aiori_posix_mkdir(const char *path, mode_t mode, aiori_mod_opt_t *module_options)
Definition: aiori.c:212
ior_aiori_t posix_aiori
Definition: aiori-POSIX.c:160
ior_aiori_t dfs_aiori
Definition: aiori-DFS.c:133
uint64_t f_bavail
Definition: aiori.h:55
int aiori_posix_rmdir(const char *path, aiori_mod_opt_t *module_options)
Definition: aiori.c:217
bool enable_mdtest
Definition: aiori.h:115
int aiori_posix_stat(const char *path, struct stat *buf, aiori_mod_opt_t *module_options)
Definition: aiori.c:227
int randomOffset
Definition: aiori.h:69
struct aiori_xfer_hint_t aiori_xfer_hint_t
void aiori_supported_apis(char *APIs, char *APIs_legacy, enum bench_type type)
Definition: aiori.c:127
ior_aiori_t s3_plus_aiori
Definition: aiori-S3-4c.c:200
struct aiori_fd_t aiori_fd_t
struct ior_aiori ior_aiori_t
const char * aiori_default(void)
Definition: aiori.c:296
ior_aiori_t S3_libS3_aiori
ior_aiori_t daos_aiori
int fsyncPerWrite
Definition: aiori.h:70
char * name
Definition: aiori.h:88
int filePerProc
Definition: aiori.h:65
long long int IOR_offset_t
Definition: iordef.h:109
ior_aiori_t aio_aiori
Definition: aiori-aio.c:234
void * airoi_update_module_options(const ior_aiori_t *backend, options_all_t *module_defaults)
Definition: aiori.c:93
int MPIIO_Access(const char *, int, aiori_mod_opt_t *module_options)
Definition: aiori-MPIIO.c:139
ior_aiori_t ncmpi_aiori
Definition: aiori-NCMPI.c:100