QUDA  0.9.0
Classes | Macros | Functions | Variables
comm_mpi.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include <csignal>
#include <quda_internal.h>
#include <comm_quda.h>
Include dependency graph for comm_mpi.cpp:

Go to the source code of this file.

Classes

struct  MsgHandle_s
 

Macros

#define MPI_CHECK(mpi_call)
 

Functions

void comm_gather_hostname (char *hostname_recv_buf)
 Gather all hostnames. More...
 
void comm_gather_gpuid (int *gpuid_recv_buf)
 Gather all GPU ids. More...
 
void comm_init (int ndim, const int *dims, QudaCommsMap rank_from_coords, void *map_data)
 
int comm_rank (void)
 
int comm_size (void)
 
int comm_gpuid (void)
 
static void check_displacement (const int displacement[], int ndim)
 
MsgHandlecomm_declare_send_displaced (void *buffer, const int displacement[], size_t nbytes)
 
MsgHandlecomm_declare_receive_displaced (void *buffer, const int displacement[], size_t nbytes)
 
MsgHandlecomm_declare_strided_send_displaced (void *buffer, const int displacement[], size_t blksize, int nblocks, size_t stride)
 
MsgHandlecomm_declare_strided_receive_displaced (void *buffer, const int displacement[], size_t blksize, int nblocks, size_t stride)
 
void comm_free (MsgHandle *mh)
 
void comm_start (MsgHandle *mh)
 
void comm_wait (MsgHandle *mh)
 
int comm_query (MsgHandle *mh)
 
void comm_allreduce (double *data)
 
void comm_allreduce_max (double *data)
 
void comm_allreduce_array (double *data, size_t size)
 
void comm_allreduce_int (int *data)
 
void comm_allreduce_xor (uint64_t *data)
 
void comm_broadcast (void *data, size_t nbytes)
 
void comm_barrier (void)
 
void comm_abort (int status)
 
const char * comm_dim_partitioned_string ()
 Return a string that defines the comm partitioning (used as a tuneKey) More...
 
const char * comm_dim_topology_string ()
 Return a string that defines the comm topology (for use as a tuneKey) More...
 

Variables

static int rank = -1
 
static int size = -1
 
static int gpuid = -1
 
static char partition_string [16]
 
static char topology_string [16]
 
static const int max_displacement = 4
 

Macro Definition Documentation

◆ MPI_CHECK

#define MPI_CHECK (   mpi_call)
Value:
do { \
int status = mpi_call; \
if (status != MPI_SUCCESS) { \
char err_string[128]; \
int err_len; \
MPI_Error_string(status, err_string, &err_len); \
err_string[127] = '\0'; \
errorQuda("(MPI) %s", err_string); \
} \
} while (0)

Definition at line 10 of file comm_mpi.cpp.

Referenced by comm_allreduce(), comm_allreduce_array(), comm_allreduce_int(), comm_allreduce_max(), comm_allreduce_xor(), comm_barrier(), comm_broadcast(), comm_declare_receive_displaced(), comm_declare_send_displaced(), comm_declare_strided_receive_displaced(), comm_declare_strided_send_displaced(), comm_free(), comm_gather_gpuid(), comm_gather_hostname(), comm_init(), comm_query(), comm_start(), and comm_wait().

Function Documentation

◆ check_displacement()

static void check_displacement ( const int  displacement[],
int  ndim 
)
static

Definition at line 140 of file comm_mpi.cpp.

References abs(), errorQuda, fused_exterior_ndeg_tm_dslash_cuda_gen::i, max_displacement, and ndim.

Referenced by comm_declare_receive_displaced(), comm_declare_send_displaced(), comm_declare_strided_receive_displaced(), and comm_declare_strided_send_displaced().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ comm_abort()

void comm_abort ( int  status)

Definition at line 334 of file comm_mpi.cpp.

◆ comm_allreduce()

void comm_allreduce ( double data)

Definition at line 281 of file comm_mpi.cpp.

References MPI_Allreduce(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_allreduce_array()

void comm_allreduce_array ( double data,
size_t  size 
)

Definition at line 296 of file comm_mpi.cpp.

References memcpy(), MPI_Allreduce(), MPI_CHECK, and size.

Here is the call graph for this function:

◆ comm_allreduce_int()

void comm_allreduce_int ( int data)

Definition at line 305 of file comm_mpi.cpp.

References MPI_Allreduce(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_allreduce_max()

void comm_allreduce_max ( double data)

Definition at line 289 of file comm_mpi.cpp.

References MPI_Allreduce(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_allreduce_xor()

void comm_allreduce_xor ( uint64_t data)

Definition at line 312 of file comm_mpi.cpp.

References errorQuda, MPI_Allreduce(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_barrier()

void comm_barrier ( void  )

Definition at line 328 of file comm_mpi.cpp.

References MPI_Barrier(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_broadcast()

void comm_broadcast ( void *  data,
size_t  nbytes 
)

broadcast from rank 0

Definition at line 322 of file comm_mpi.cpp.

References MPI_Bcast(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_declare_receive_displaced()

MsgHandle* comm_declare_receive_displaced ( void *  buffer,
const int  displacement[],
size_t  nbytes 
)

Declare a message handle for receiving from a node displaced in (x,y,z,t) according to "displacement"

Definition at line 174 of file comm_mpi.cpp.

References check_displacement(), comm_default_topology(), comm_ndim(), comm_rank_displaced(), MsgHandle_s::custom, fused_exterior_ndeg_tm_dslash_cuda_gen::i, max_displacement, MPI_CHECK, MPI_Recv_init(), ndim, pow(), rank, MsgHandle_s::request, and safe_malloc.

Here is the call graph for this function:

◆ comm_declare_send_displaced()

MsgHandle* comm_declare_send_displaced ( void *  buffer,
const int  displacement[],
size_t  nbytes 
)

Declare a message handle for sending to a node displaced in (x,y,z,t) according to "displacement"

Definition at line 151 of file comm_mpi.cpp.

References check_displacement(), comm_default_topology(), comm_ndim(), comm_rank_displaced(), MsgHandle_s::custom, fused_exterior_ndeg_tm_dslash_cuda_gen::i, max_displacement, MPI_CHECK, MPI_Send_init(), ndim, pow(), rank, MsgHandle_s::request, and safe_malloc.

Here is the call graph for this function:

◆ comm_declare_strided_receive_displaced()

MsgHandle* comm_declare_strided_receive_displaced ( void *  buffer,
const int  displacement[],
size_t  blksize,
int  nblocks,
size_t  stride 
)

Declare a message handle for receiving from a node displaced in (x,y,z,t) according to "displacement"

Definition at line 226 of file comm_mpi.cpp.

References check_displacement(), comm_default_topology(), comm_ndim(), comm_rank_displaced(), MsgHandle_s::custom, MsgHandle_s::datatype, fused_exterior_ndeg_tm_dslash_cuda_gen::i, max_displacement, MPI_CHECK, MPI_Recv_init(), ndim, pow(), rank, MsgHandle_s::request, and safe_malloc.

Here is the call graph for this function:

◆ comm_declare_strided_send_displaced()

MsgHandle* comm_declare_strided_send_displaced ( void *  buffer,
const int  displacement[],
size_t  blksize,
int  nblocks,
size_t  stride 
)

Declare a message handle for sending to a node displaced in (x,y,z,t) according to "displacement"

Definition at line 197 of file comm_mpi.cpp.

References check_displacement(), comm_default_topology(), comm_ndim(), comm_rank_displaced(), MsgHandle_s::custom, MsgHandle_s::datatype, fused_exterior_ndeg_tm_dslash_cuda_gen::i, max_displacement, MPI_CHECK, MPI_Send_init(), ndim, pow(), rank, MsgHandle_s::request, and safe_malloc.

Here is the call graph for this function:

◆ comm_dim_partitioned_string()

const char* comm_dim_partitioned_string ( )

Return a string that defines the comm partitioning (used as a tuneKey)

Returns
String specifying comm partitioning

Definition at line 342 of file comm_mpi.cpp.

References partition_string.

◆ comm_dim_topology_string()

const char* comm_dim_topology_string ( )

Return a string that defines the comm topology (for use as a tuneKey)

Returns
String specifying comm topology

Definition at line 346 of file comm_mpi.cpp.

References topology_string.

◆ comm_free()

void comm_free ( MsgHandle mh)

◆ comm_gather_gpuid()

void comm_gather_gpuid ( int gpuid_recv_buf)

Gather all GPU ids.

Parameters
[out]gpuid_recv_bufint array of length comm_size() that will be filled in GPU ids for all processes (in rank order).

Definition at line 56 of file comm_mpi.cpp.

References gpuid, MPI_Allgather(), and MPI_CHECK.

Here is the call graph for this function:

◆ comm_gather_hostname()

void comm_gather_hostname ( char *  hostname_recv_buf)

Gather all hostnames.

Parameters
[out]hostname_recv_bufchar array of length 128*comm_size() that will be filled in GPU ids for all processes. Each hostname is in rank order, with 128 bytes for each.

Definition at line 50 of file comm_mpi.cpp.

References comm_hostname(), MPI_Allgather(), and MPI_CHECK.

Referenced by comm_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ comm_gpuid()

int comm_gpuid ( void  )

Definition at line 132 of file comm_mpi.cpp.

References gpuid.

◆ comm_init()

void comm_init ( int  ndim,
const int dims,
QudaCommsMap  rank_from_coords,
void *  map_data 
)

◆ comm_query()

int comm_query ( MsgHandle mh)

Definition at line 272 of file comm_mpi.cpp.

References MPI_CHECK, MPI_Test(), and MsgHandle_s::request.

Here is the call graph for this function:

◆ comm_rank()

int comm_rank ( void  )

Definition at line 120 of file comm_mpi.cpp.

References rank.

Referenced by comm_init().

Here is the caller graph for this function:

◆ comm_size()

int comm_size ( void  )

Definition at line 126 of file comm_mpi.cpp.

References size.

◆ comm_start()

void comm_start ( MsgHandle mh)

Definition at line 260 of file comm_mpi.cpp.

References MPI_CHECK, MPI_Start(), and MsgHandle_s::request.

Here is the call graph for this function:

◆ comm_wait()

void comm_wait ( MsgHandle mh)

Definition at line 266 of file comm_mpi.cpp.

References MPI_CHECK, MPI_Wait(), and MsgHandle_s::request.

Here is the call graph for this function:

Variable Documentation

◆ gpuid

int gpuid = -1
static

Definition at line 44 of file comm_mpi.cpp.

Referenced by comm_gather_gpuid(), comm_gpuid(), comm_init(), and comm_peer2peer_init().

◆ max_displacement

const int max_displacement = 4
static

◆ partition_string

char partition_string[16]
static

Definition at line 46 of file comm_mpi.cpp.

Referenced by comm_dim_partitioned_string(), and comm_init().

◆ rank

int rank = -1
static

◆ size

int size = -1
static

Definition at line 43 of file comm_mpi.cpp.

Referenced by comm_allreduce_array(), comm_init(), and comm_size().

◆ topology_string

char topology_string[16]
static

Definition at line 47 of file comm_mpi.cpp.

Referenced by comm_dim_topology_string(), and comm_init().