Debian Codegraph @

src/mpi/romio/adio/ad_daos/ad_daos.h

raw
1 /*
2 * Copyright (C) by Argonne National Laboratory
3 * See COPYRIGHT in top-level directory
4 */
5
6 #ifndef AD_DAOS_H_INCLUDED
7 #define AD_DAOS_H_INCLUDED
8
9 #include "adio.h"
10 #include <assert.h>
11 #include <gurt/list.h>
12 #include <daos.h>
13 #include <daos_fs.h>
14 #include <daos_uns.h>
15
16 /* #define D_PRINT_IO */
17 /* #define D_PRINT_IO_MEM */
18
19 #define PRINT_MSG(str, fmt, ...) \
20 do { \
21 fprintf(str, "%s:%d %s() - " fmt"\n" , \
22 __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
23 } while (0)
24
25 #if defined(DAOS_API_VERSION_MAJOR) && defined(DAOS_API_VERSION_MINOR)
26 #define CHECK_DAOS_API_VERSION(major, minor) \
27 ((DAOS_API_VERSION_MAJOR > (major)) \
28 || (DAOS_API_VERSION_MAJOR == (major) && DAOS_API_VERSION_MINOR >= (minor)))
29 #else
30 #define CHECK_DAOS_API_VERSION(major, minor) 0
31 #endif
32
33 extern bool adio_daos_bypass_duns;
34 extern const char *adio_daos_path_prefix;
35
36 struct adio_daos_hdl {
37 d_list_t entry;
38 char value[DAOS_PROP_LABEL_MAX_LEN + 1];
39 daos_handle_t open_hdl;
40 dfs_t *dfs;
41 int ref;
42 int type;
43 };
44
45 struct ADIO_DAOS_cont {
46 /** pool, container uuids + other attributes */
47 struct duns_attr_t attr;
48 /** Container name (Path to the file opened) */
49 char *cont_name;
50 /** Object name (File name) */
51 char *obj_name;
52 /** pool open handle */
53 daos_handle_t poh;
54 /** container open handle */
55 daos_handle_t coh;
56 /** flat namespace mount */
57 dfs_t *dfs;
58 /** dfs object for file */
59 dfs_obj_t *obj;
60 /** Array Object ID for the MPI file */
61 daos_obj_id_t oid;
62 /** file open mode */
63 unsigned int amode;
64 /** Event queue to store all async requests on file */
65 daos_handle_t eqh;
66 /** pool handle for directory holding the file object */
67 struct adio_daos_hdl *p;
68 /** container handle for directory holding the file object */
69 struct adio_daos_hdl *c;
70 };
71
72 struct ADIO_DAOS_req {
73 MPI_Request req;
74 daos_size_t nbytes;
75 daos_event_t daos_event;
76 dfs_iod_t iod;
77 daos_range_t rg;
78 d_sg_list_t sgl;
79 d_iov_t iov;
80 daos_range_t *rgs;
81 d_iov_t *iovs;
82 };
83
84 /** initialize the DAOS library and hashtables for handles */
85 void ADIOI_DAOS_Init(int *error_code);
86
87 /** Container/Pool Handle Hash functions */
88 int adio_daos_hash_init(void);
89 void adio_daos_hash_finalize(void);
90 struct adio_daos_hdl *adio_daos_poh_lookup(struct duns_attr_t *attr);
91 int adio_daos_poh_insert(struct duns_attr_t *attr, daos_handle_t poh, struct adio_daos_hdl **hdl);
92 int adio_daos_poh_lookup_connect(struct duns_attr_t *attr, struct adio_daos_hdl **hdl);
93 void adio_daos_poh_release(struct adio_daos_hdl *hdl);
94 struct adio_daos_hdl *adio_daos_coh_lookup(struct duns_attr_t *attr);
95 int adio_daos_coh_insert(struct duns_attr_t *attr, daos_handle_t coh, dfs_t * dfs,
96 struct adio_daos_hdl **hdl);
97 int adio_daos_coh_lookup_create(daos_handle_t poh, struct duns_attr_t *attr, int amode,
98 bool create, struct adio_daos_hdl **hdl);
99 void adio_daos_coh_release(struct adio_daos_hdl *hdl);
100
101 int ADIOI_DAOS_aio_free_fn(void *extra_state);
102 int ADIOI_DAOS_aio_poll_fn(void *extra_state, MPI_Status * status);
103 int ADIOI_DAOS_aio_wait_fn(int count, void **array_of_states, double timeout, MPI_Status * status);
104 int ADIOI_DAOS_err(const char *myname, const char *filename, int line, int rc);
105
106 void ADIOI_DAOS_Open(ADIO_File fd, int *error_code);
107 void ADIOI_DAOS_OpenColl(ADIO_File fd, int rank, int access_mode, int *error_code);
108 int ADIOI_DAOS_Feature(ADIO_File fd, int flag);
109 void ADIOI_DAOS_Flush(ADIO_File fd, int *error_code);
110 void ADIOI_DAOS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
111 void ADIOI_DAOS_Close(ADIO_File fd, int *error_code);
112 void ADIOI_DAOS_Delete(const char *filename, int *error_code);
113 void ADIOI_DAOS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t * fcntl_struct, int *error_code);
114 void ADIOI_DAOS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
115 void ADIOI_DAOS_ReadContig(ADIO_File fd, void *buf, MPI_Aint count,
116 MPI_Datatype datatype, int file_ptr_type,
117 ADIO_Offset offset, ADIO_Status * status, int *error_code);
118 void ADIOI_DAOS_WriteContig(ADIO_File fd, const void *buf, MPI_Aint count,
119 MPI_Datatype datatype, int file_ptr_type,
120 ADIO_Offset offset, ADIO_Status * status, int *error_code);
121 void ADIOI_DAOS_IReadContig(ADIO_File fd, void *buf, MPI_Aint count,
122 MPI_Datatype datatype, int file_ptr_type,
123 ADIO_Offset offset, MPI_Request * request, int *error_code);
124 void ADIOI_DAOS_IWriteContig(ADIO_File fd, const void *buf, MPI_Aint count,
125 MPI_Datatype datatype, int file_ptr_type,
126 ADIO_Offset offset, MPI_Request * request, int *error_code);
127 void ADIOI_DAOS_ReadStrided(ADIO_File fd, void *buf, MPI_Aint count,
128 MPI_Datatype datatype, int file_ptr_type,
129 ADIO_Offset offset, ADIO_Status * status, int *error_code);
130 void ADIOI_DAOS_WriteStrided(ADIO_File fd, const void *buf, MPI_Aint count,
131 MPI_Datatype datatype, int file_ptr_type,
132 ADIO_Offset offset, ADIO_Status * status, int *error_code);
133 void ADIOI_DAOS_IreadStrided(ADIO_File fd, void *buf, MPI_Aint count,
134 MPI_Datatype datatype, int file_ptr_type,
135 ADIO_Offset offset, ADIO_Request * request, int *error_code);
136 void ADIOI_DAOS_IwriteStrided(ADIO_File fd, const void *buf, MPI_Aint count,
137 MPI_Datatype datatype, int file_ptr_type,
138 ADIO_Offset offset, MPI_Request * request, int *error_code);
139 #endif /* AD_DAOS_H_INCLUDED */