23 #include <sys/types.h> 27 #include <gurt/common.h> 50 .chunk_size = 1048576,
104 #define IOR_DAOS_MUR_SEED 0xDEAD10CC 121 #define DCHECK(rc, format, ...) \ 126 fprintf(stderr, "ior ERROR (%s:%d): %d: %d: " \ 127 format"\n", __FILE__, __LINE__, rank, _rc, \ 130 MPI_Abort(MPI_COMM_WORLD, -1); \ 134 #define INFO(level, format, ...) \ 136 if (verbose >= level) \ 137 printf("[%d] "format"\n", rank, ##__VA_ARGS__); \ 141 #define GERR(format, ...) \ 143 fprintf(stderr, format"\n", ##__VA_ARGS__); \ 144 MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error"); \ 154 global.iov_buf =
NULL;
155 global.iov_buf_len = 0;
161 rc = daos_pool_local2global(*handle, &global);
163 rc = daos_cont_local2global(*handle, &global);
165 rc = daos_array_local2global(*handle, &global);
166 DCHECK(rc,
"Failed to get global handle size");
169 MPI_CHECK(MPI_Bcast(&global.iov_buf_len, 1, MPI_UINT64_T, 0,
171 "Failed to bcast global handle buffer size");
173 global.iov_len = global.iov_buf_len;
174 global.iov_buf = malloc(global.iov_buf_len);
175 if (global.iov_buf ==
NULL)
176 ERR(
"Failed to allocate global handle buffer");
180 rc = daos_pool_local2global(*handle, &global);
182 rc = daos_cont_local2global(*handle, &global);
184 rc = daos_array_local2global(*handle, &global);
185 DCHECK(rc,
"Failed to create global handle");
188 MPI_CHECK(MPI_Bcast(global.iov_buf, global.iov_buf_len, MPI_BYTE, 0,
190 "Failed to bcast global pool handle");
194 rc = daos_pool_global2local(global, handle);
196 rc = daos_cont_global2local(
poh, global, handle);
198 rc = daos_array_global2local(
coh, global, 0, handle);
199 DCHECK(rc,
"Failed to get local handle");
202 free(global.iov_buf);
225 GERR(
"Invalid DAOS Object class %s\n", o.
oclass);
230 DCHECK(rc,
"Failed to initialize daos");
235 static daos_pool_info_t po_info;
236 static daos_cont_info_t co_info;
240 rc = uuid_parse(o.
pool, uuid);
241 DCHECK(rc,
"Failed to parse 'pool': %s", o.
pool);
243 svcl = daos_rank_list_parse(o.
svcl,
":");
245 ERR(
"Failed to allocate svcl");
247 rc = daos_pool_connect(uuid, o.
group, svcl, DAOS_PC_RW,
249 d_rank_list_free(svcl);
250 DCHECK(rc,
"Failed to connect to pool %s", o.
pool);
255 rc = uuid_parse(o.
cont, uuid);
256 DCHECK(rc,
"Failed to parse 'cont': %s", o.
cont);
258 rc = daos_cont_open(
poh, uuid, DAOS_COO_RW, &
coh, &co_info,
261 if (rc == -DER_NONEXIST) {
265 rc = daos_cont_open(
poh, uuid, DAOS_COO_RW,
268 DCHECK(rc,
"Failed to create container");
286 MPI_Barrier(MPI_COMM_WORLD);
287 rc = daos_cont_close(
coh,
NULL);
289 DCHECK(rc,
"Failed to close container %s (%d)", o.
cont, rc);
290 MPI_Abort(MPI_COMM_WORLD, -1);
292 MPI_Barrier(MPI_COMM_WORLD);
300 uuid_parse(o.
cont, uuid);
302 rc = daos_cont_destroy(
poh, uuid, 1,
NULL);
308 MPI_Bcast(&rc, 1, MPI_INT, 0, MPI_COMM_WORLD);
311 DCHECK(rc,
"Failed to destroy container %s (%d)", o.
cont, rc);
312 MPI_Abort(MPI_COMM_WORLD, -1);
319 rc = daos_pool_disconnect(
poh,
NULL);
320 DCHECK(rc,
"Failed to disconnect from pool %s", o.
pool);
322 MPI_CHECK(MPI_Barrier(MPI_COMM_WORLD),
"barrier error");
327 DCHECK(rc,
"Failed to finalize daos");
353 rc = daos_array_create(
coh, oid, DAOS_TX_NONE, 1, o.
chunk_size,
355 DCHECK(rc,
"Failed to create array object\n");
375 rc = daos_array_open(
coh, oid, DAOS_TX_NONE, DAOS_OO_RO,
376 &cell_size, &chunk_size, &
aoh,
NULL);
381 GERR(
"Invalid DAOS Array object.\n");
383 rc = daos_array_close(
aoh,
NULL);
401 rc = daos_array_open(
coh, oid, DAOS_TX_NONE, DAOS_OO_RW,
402 &cell_size, &chunk_size, &
aoh,
NULL);
403 DCHECK(rc,
"Failed to create array object\n");
406 GERR(
"Invalid DAOS Array object.\n");
420 daos_array_iod_t iod;
429 rg.rg_idx = param->
offset;
434 d_iov_set(&iov, buffer, length);
437 if (access ==
WRITE) {
438 rc = daos_array_write(
aoh, DAOS_TX_NONE, &iod, &sgl,
NULL);
439 DCHECK(rc,
"daos_array_write() failed (%d).", rc);
441 rc = daos_array_read(
aoh, DAOS_TX_NONE, &iod, &sgl,
NULL);
442 DCHECK(rc,
"daos_array_read() failed (%d).", rc);
454 GERR(
"DAOS is not initialized!");
456 rc = daos_array_close(
aoh,
NULL);
457 DCHECK(rc,
"daos_array_close() failed (%d).", rc);
470 GERR(
"DAOS is not initialized!");
476 rc = daos_array_open(
coh, oid, DAOS_TX_NONE, DAOS_OO_RW,
477 &cell_size, &chunk_size, &
aoh,
NULL);
478 DCHECK(rc,
"daos_array_open() failed (%d).", rc);
481 GERR(
"Invalid DAOS Array object.\n");
483 rc = daos_array_destroy(
aoh, DAOS_TX_NONE,
NULL);
484 DCHECK(rc,
"daos_array_destroy() failed (%d).", rc);
486 rc = daos_array_close(
aoh,
NULL);
487 DCHECK(rc,
"daos_array_close() failed (%d).", rc);
494 static char ver[1024] = {};
496 sprintf(ver,
"%s",
"DAOS");
514 GERR(
"DAOS is not initialized!");
523 rc = daos_array_open(
coh, oid, DAOS_TX_NONE, DAOS_OO_RO,
524 &cell_size, &chunk_size, &
aoh,
NULL);
525 DCHECK(rc,
"daos_array_open() failed (%d).", rc);
528 GERR(
"Invalid DAOS Array object.\n");
530 rc = daos_array_get_size(
aoh, DAOS_TX_NONE, &size,
NULL);
531 DCHECK(rc,
"daos_array_get_size() failed (%d).", rc);
533 rc = daos_array_close(
aoh,
NULL);
534 DCHECK(rc,
"daos_array_close() failed (%d).", rc);
539 MPI_Bcast(&size, 1, MPI_LONG, 0, MPI_COMM_WORLD);
static void gen_oid(const char *name, daos_obj_id_t *oid)
static void DAOS_Fsync(void *, IOR_param_t *)
static void * DAOS_Open(char *, IOR_param_t *)
static IOR_offset_t DAOS_GetFileSize(IOR_param_t *, MPI_Comm, char *)
int aiori_posix_rmdir(const char *path, IOR_param_t *param)
static daos_oclass_id_t objectClass
int aiori_posix_mkdir(const char *path, mode_t mode, IOR_param_t *param)
static IOR_offset_t DAOS_Xfer(int, void *, IOR_size_t *, IOR_offset_t, IOR_param_t *)
static void * DAOS_Create(char *, IOR_param_t *)
int aiori_posix_statfs(const char *path, ior_aiori_statfs_t *stat_buf, IOR_param_t *param)
static void DAOS_Close(void *, IOR_param_t *)
static void DAOS_Delete(char *, IOR_param_t *)
#define IOR_DAOS_MUR_SEED
static char * DAOS_GetVersion()
static option_help options[]
#define MPI_CHECK(MPI_STATUS, MSG)
static option_help * DAOS_options()
static struct daos_options o
static bool daos_initialized
#define INFO(level, format,...)
static void HandleDistribute(daos_handle_t *handle, enum handleType type)
int aiori_posix_stat(const char *path, struct stat *buf, IOR_param_t *param)
static int DAOS_Access(const char *, int, IOR_param_t *)
long long int IOR_offset_t
#define DCHECK(rc, format,...)