6 #define QMP_CHECK(qmp_call) do { \
7 QMP_status_t status = qmp_call; \
8 if (status != QMP_SUCCESS) \
9 errorQuda("(QMP) %s", QMP_error_string(status)); \
17 static int gpuid = -1;
22 if ( QMP_is_initialized() != QMP_TRUE ) {
23 errorQuda(
"QMP has not been initialized");
27 for (
int i = 0; i < ndim; i++) {
30 if (grid_size != QMP_get_number_of_nodes()) {
31 errorQuda(
"Communication grid size declared via initCommsGridQuda() does not match"
32 " total number of QMP nodes (%d != %d)", grid_size, QMP_get_number_of_nodes());
41 cudaGetDeviceCount(&device_count);
42 if (device_count == 0) {
52 return QMP_get_node_number();
58 return QMP_get_number_of_nodes();
78 mh->
mem = QMP_declare_msgmem(buffer, nbytes);
79 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
81 mh->
handle = QMP_declare_send_to(mh->
mem, rank, 0);
82 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
97 mh->
mem = QMP_declare_msgmem(buffer, nbytes);
98 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
100 mh->
handle = QMP_declare_receive_from(mh->
mem, rank, 0);
101 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
112 size_t blksize,
int nblocks,
size_t stride)
119 mh->
mem = QMP_declare_strided_msgmem(buffer, blksize, nblocks, stride);
120 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
122 mh->
handle = QMP_declare_send_to(mh->
mem, rank, 0);
123 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
133 size_t blksize,
int nblocks,
size_t stride)
140 mh->
mem = QMP_declare_strided_msgmem(buffer, blksize, nblocks, stride);
141 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
143 mh->
handle = QMP_declare_receive_from(mh->
mem, rank, 0);
144 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
152 QMP_free_msghandle(mh->
handle);
153 QMP_free_msgmem(mh->
mem);
172 return (QMP_is_complete(mh->
handle) == QMP_TRUE);
190 QMP_CHECK( QMP_sum_double_array(data, size) );
202 QMP_CHECK( QMP_broadcast(data, nbytes) );
int comm_query(MsgHandle *mh)
Topology * comm_create_topology(int ndim, const int *dims, QudaCommsMap rank_from_coords, void *map_data)
Topology * comm_default_topology(void)
void comm_wait(MsgHandle *mh)
void comm_free(MsgHandle *mh)
void comm_start(MsgHandle *mh)
MsgHandle * comm_declare_strided_send_displaced(void *buffer, const int displacement[], size_t blksize, int nblocks, size_t stride)
MsgHandle * comm_declare_strided_receive_displaced(void *buffer, const int displacement[], size_t blksize, int nblocks, size_t stride)
void comm_allreduce(double *data)
void comm_abort(int status)
#define QMP_CHECK(qmp_call)
int comm_rank_displaced(const Topology *topo, const int displacement[])
void comm_init(int ndim, const int *dims, QudaCommsMap rank_from_coords, void *map_data)
#define safe_malloc(size)
void comm_allreduce_max(double *data)
void comm_set_default_topology(Topology *topo)
void comm_allreduce_int(int *data)
MsgHandle * comm_declare_receive_displaced(void *buffer, const int displacement[], size_t nbytes)
void comm_allreduce_array(double *data, size_t size)
void comm_broadcast(void *data, size_t nbytes)
int(* QudaCommsMap)(const int *coords, void *fdata)
MsgHandle * comm_declare_send_displaced(void *buffer, const int displacement[], size_t nbytes)