This source file includes following definitions.
- opal_convertor_cuda_need_buffers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef OPAL_MCA_COMMON_CUDA_H
24 #define OPAL_MCA_COMMON_CUDA_H
25 #include "opal/mca/btl/btl.h"
26 #include "opal/datatype/opal_convertor.h"
27
28 #define MEMHANDLE_SIZE 8
29 #define EVTHANDLE_SIZE 8
30
31 struct mca_rcache_common_cuda_reg_data_t {
32 uint64_t memHandle[MEMHANDLE_SIZE];
33 uint64_t evtHandle[EVTHANDLE_SIZE];
34 uint64_t event;
35 opal_ptr_t memh_seg_addr;
36 size_t memh_seg_len;
37 };
38 typedef struct mca_rcache_common_cuda_reg_data_t mca_rcache_common_cuda_reg_data_t;
39
40 struct mca_rcache_common_cuda_reg_t {
41 mca_rcache_base_registration_t base;
42 mca_rcache_common_cuda_reg_data_t data;
43 };
44 typedef struct mca_rcache_common_cuda_reg_t mca_rcache_common_cuda_reg_t;
45 extern bool mca_common_cuda_enabled;
46
47 OPAL_DECLSPEC void mca_common_cuda_register_mca_variables(void);
48
49 OPAL_DECLSPEC void mca_common_cuda_register(void *ptr, size_t amount, char *msg);
50
51 OPAL_DECLSPEC void mca_common_cuda_unregister(void *ptr, char *msg);
52
53 OPAL_DECLSPEC void mca_common_wait_stream_synchronize(mca_rcache_common_cuda_reg_t *rget_reg);
54
55 OPAL_DECLSPEC int mca_common_cuda_memcpy(void *dst, void *src, size_t amount, char *msg,
56 struct mca_btl_base_descriptor_t *, int *done);
57
58 OPAL_DECLSPEC int mca_common_cuda_record_ipc_event(char *msg,
59 struct mca_btl_base_descriptor_t *frag);
60 OPAL_DECLSPEC int mca_common_cuda_record_dtoh_event(char *msg,
61 struct mca_btl_base_descriptor_t *frag);
62 OPAL_DECLSPEC int mca_common_cuda_record_htod_event(char *msg,
63 struct mca_btl_base_descriptor_t *frag);
64
65 OPAL_DECLSPEC void *mca_common_cuda_get_dtoh_stream(void);
66 OPAL_DECLSPEC void *mca_common_cuda_get_htod_stream(void);
67
68 OPAL_DECLSPEC int progress_one_cuda_ipc_event(struct mca_btl_base_descriptor_t **);
69 OPAL_DECLSPEC int progress_one_cuda_dtoh_event(struct mca_btl_base_descriptor_t **);
70 OPAL_DECLSPEC int progress_one_cuda_htod_event(struct mca_btl_base_descriptor_t **);
71
72 OPAL_DECLSPEC int mca_common_cuda_memhandle_matches(mca_rcache_common_cuda_reg_t *new_reg,
73 mca_rcache_common_cuda_reg_t *old_reg);
74
75 OPAL_DECLSPEC void mca_common_cuda_construct_event_and_handle(uintptr_t *event, void *handle);
76 OPAL_DECLSPEC void mca_common_cuda_destruct_event(uintptr_t event);
77
78 OPAL_DECLSPEC int cuda_getmemhandle(void *base, size_t, mca_rcache_base_registration_t *newreg,
79 mca_rcache_base_registration_t *hdrreg);
80 OPAL_DECLSPEC int cuda_ungetmemhandle(void *reg_data, mca_rcache_base_registration_t *reg);
81 OPAL_DECLSPEC int cuda_openmemhandle(void *base, size_t size, mca_rcache_base_registration_t *newreg,
82 mca_rcache_base_registration_t *hdrreg);
83 OPAL_DECLSPEC int cuda_closememhandle(void *reg_data, mca_rcache_base_registration_t *reg);
84 OPAL_DECLSPEC int mca_common_cuda_get_device(int *devicenum);
85 OPAL_DECLSPEC int mca_common_cuda_device_can_access_peer(int *access, int dev1, int dev2);
86 OPAL_DECLSPEC int mca_common_cuda_stage_one_init(void);
87 OPAL_DECLSPEC int mca_common_cuda_get_address_range(void *pbase, size_t *psize, void *base);
88 OPAL_DECLSPEC void mca_common_cuda_fini(void);
89 #if OPAL_CUDA_GDR_SUPPORT
90 OPAL_DECLSPEC bool mca_common_cuda_previously_freed_memory(mca_rcache_base_registration_t *reg);
91 OPAL_DECLSPEC void mca_common_cuda_get_buffer_id(mca_rcache_base_registration_t *reg);
92 #endif
93
94
95
96
97
98
99
100
101 static inline int32_t opal_convertor_cuda_need_buffers( opal_convertor_t* pConvertor )
102 {
103 int32_t retval;
104 uint32_t cudaflag = pConvertor->flags & CONVERTOR_CUDA;
105 pConvertor->flags &= ~CONVERTOR_CUDA;
106 retval = opal_convertor_need_buffers(pConvertor);
107 pConvertor->flags |= cudaflag;
108 return retval;
109 }
110
111 #endif