7 #define QMP_CHECK(qmp_call) do { \
8 QMP_status_t status = qmp_call; \
9 if (status != QMP_SUCCESS) \
10 errorQuda("(QMP) %s", QMP_error_string(status)); \
20 static int gpuid = -1;
25 if ( QMP_is_initialized() != QMP_TRUE ) {
26 errorQuda(
"QMP has not been initialized");
30 for (
int i = 0; i < ndim; i++) {
33 if (grid_size != QMP_get_number_of_nodes()) {
34 errorQuda(
"Communication grid size declared via initCommsGridQuda() does not match"
35 " total number of QMP nodes (%d != %d)", grid_size, QMP_get_number_of_nodes());
44 cudaGetDeviceCount(&device_count);
45 if (device_count == 0) {
55 return QMP_get_node_number();
61 return QMP_get_number_of_nodes();
81 mh->
mem = QMP_declare_msgmem(buffer, nbytes);
82 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
84 mh->
handle = QMP_declare_send_to(mh->
mem, rank, 0);
85 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
101 mh->
mem = QMP_declare_msgmem(buffer, nbytes);
102 if (mh->
mem == NULL)
errorQuda(
"Unable to allocate QMP message memory");
104 mh->
handle = QMP_declare_receive_from(mh->
mem, rank, 0);
105 if (mh->
handle == NULL)
errorQuda(
"Unable to allocate QMP message handle");
113 QMP_free_msghandle(mh->
handle);
114 QMP_free_msgmem(mh->
mem);
133 return (QMP_is_complete(mh->
handle) == QMP_TRUE);
151 QMP_CHECK( QMP_sum_double_array(data, size) );
163 QMP_CHECK( QMP_broadcast(data, nbytes) );