QUDA  v1.1.0
A library for QCD on GPUs
Functions
communicator_stack.cpp File Reference
#include <communicator_quda.h>
#include <map>
#include <array>
#include <lattice_field.h>

Go to the source code of this file.

Functions

void init_communicator_stack (int ndim, const int *dims, QudaCommsMap rank_from_coords, void *map_data, bool user_set_comm_handle, void *user_comm)
 
void finalize_communicator_stack ()
 
Communicatorget_current_communicator ()
 
void push_communicator (const quda::CommKey &split_key)
 
int comm_neighbor_rank (int dir, int dim)
 
int comm_dim (int dim)
 
int comm_coord (int dim)
 
int comm_rank_from_coords (const int *coords)
 
void comm_init (int ndim, const int *dims, QudaCommsMap rank_from_coords, void *map_data, bool user_set_comm_handle, void *user_comm)
 Initialize the communications, implemented in comm_single.cpp, comm_qmp.cpp, and comm_mpi.cpp. More...
 
void comm_finalize ()
 
void comm_dim_partitioned_set (int dim)
 
void comm_dim_partitioned_reset ()
 
int comm_dim_partitioned (int dim)
 
int comm_partitioned ()
 Loop over comm_dim_partitioned(dim) for all comms dimensions. More...
 
const char * comm_dim_topology_string ()
 Return a string that defines the comm topology (for use as a tuneKey) More...
 
const char * comm_config_string ()
 Return a string that defines the P2P/GDR environment variable configuration (for use as a tuneKey to enable unique policies). More...
 
const char * comm_dim_partitioned_string (const int *comm_dim_override)
 Return a string that defines the comm partitioning (used as a tuneKey) More...
 
int comm_rank (void)
 
int comm_rank_global (void)
 
int comm_size (void)
 
int comm_gpuid (void)
 
bool comm_deterministic_reduce ()
 
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_peer2peer_init (const char *hostname_recv_buf)
 
bool comm_peer2peer_present ()
 Returns true if any peer-to-peer capability is present on this system (regardless of whether it has been disabled or not. We use this, for example, to determine if we need to allocate pinned device memory or not. More...
 
int comm_peer2peer_enabled_global ()
 
bool comm_peer2peer_enabled (int dir, int dim)
 
void comm_enable_peer2peer (bool enable)
 Enable / disable peer-to-peer communication: used for dslash policies that do not presently support peer-to-peer communication. More...
 
bool comm_intranode_enabled (int dir, int dim)
 
void comm_enable_intranode (bool enable)
 Enable / disable intra-node (non-peer-to-peer) communication. More...
 
bool comm_gdr_enabled ()
 Query if GPU Direct RDMA communication is enabled (global setting) More...
 
bool comm_gdr_blacklist ()
 Query if GPU Direct RDMA communication is blacklisted for this GPU. More...
 
bool comm_nvshmem_enabled ()
 Query if NVSHMEM communication is enabled (global setting) More...
 
MsgHandlecomm_declare_send_rank (void *buffer, int rank, int tag, size_t nbytes)
 
MsgHandlecomm_declare_recv_rank (void *buffer, int rank, int tag, size_t nbytes)
 
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_min (double *data)
 
void comm_allreduce_array (double *data, size_t size)
 
void comm_allreduce_max_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_broadcast_global (void *data, size_t nbytes)
 These routine broadcast the data according to the default communicator. More...
 
void comm_barrier (void)
 
void comm_abort_ (int status)
 
void reduceMaxDouble (double &max)
 
void reduceDouble (double &sum)
 
void reduceDoubleArray (double *max, const int len)
 
int commDim (int dim)
 
int commCoords (int dim)
 
int commDimPartitioned (int dir)
 
void commDimPartitionedSet (int dir)
 
void commDimPartitionedReset ()
 Reset the comm dim partioned array to zero,. More...
 
bool commGlobalReduction ()
 
void commGlobalReductionSet (bool global_reduce)
 
bool commAsyncReduction ()
 
void commAsyncReductionSet (bool global_reduce)
 
int get_enable_p2p_max_access_rank ()
 

Function Documentation

◆ comm_abort_()

void comm_abort_ ( int  status)

Definition at line 194 of file communicator_stack.cpp.

◆ comm_allreduce()

void comm_allreduce ( double *  data)

Definition at line 171 of file communicator_stack.cpp.

◆ comm_allreduce_array()

void comm_allreduce_array ( double *  data,
size_t  size 
)

Definition at line 177 of file communicator_stack.cpp.

◆ comm_allreduce_int()

void comm_allreduce_int ( int *  data)

Definition at line 184 of file communicator_stack.cpp.

◆ comm_allreduce_max()

void comm_allreduce_max ( double *  data)

Definition at line 173 of file communicator_stack.cpp.

◆ comm_allreduce_max_array()

void comm_allreduce_max_array ( double *  data,
size_t  size 
)

Definition at line 179 of file communicator_stack.cpp.

◆ comm_allreduce_min()

void comm_allreduce_min ( double *  data)

Definition at line 175 of file communicator_stack.cpp.

◆ comm_allreduce_xor()

void comm_allreduce_xor ( uint64_t *  data)

Definition at line 186 of file communicator_stack.cpp.

◆ comm_barrier()

void comm_barrier ( void  )

Definition at line 192 of file communicator_stack.cpp.

◆ comm_broadcast()

void comm_broadcast ( void *  data,
size_t  nbytes 
)

Definition at line 188 of file communicator_stack.cpp.

◆ comm_broadcast_global()

void comm_broadcast_global ( void *  data,
size_t  nbytes 
)

These routine broadcast the data according to the default communicator.

Definition at line 190 of file communicator_stack.cpp.

◆ comm_config_string()

const char* comm_config_string ( )

Return a string that defines the P2P/GDR environment variable configuration (for use as a tuneKey to enable unique policies).

Returns
String specifying comm config

Definition at line 80 of file communicator_stack.cpp.

◆ comm_coord()

int comm_coord ( int  dim)

Return the coording of this process in the dimension dim

Parameters
dimDimension which we are querying
Returns
Coordinate of this process

Definition at line 58 of file communicator_stack.cpp.

◆ comm_declare_receive_displaced()

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

Create a persistent message handler for a relative receive

Parameters
bufferBuffer into which message will be received
dimDimension from message will be received
dirDirection from messaged with be recived (0 - backwards, 1 forwards)
nbytesSize of message in bytes

Definition at line 145 of file communicator_stack.cpp.

◆ comm_declare_recv_rank()

MsgHandle* comm_declare_recv_rank ( void *  buffer,
int  rank,
int  tag,
size_t  nbytes 
)

Declare a message handle for receiving nbytes from the rank with tag.

Definition at line 135 of file communicator_stack.cpp.

◆ comm_declare_send_displaced()

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

Create a persistent message handler for a relative send

Parameters
bufferBuffer from which message will be sent
dimDimension in which message will be sent
dirDirection in which messaged with be sent (0 - backwards, 1 forwards)
nbytesSize of message in bytes

Definition at line 140 of file communicator_stack.cpp.

◆ comm_declare_send_rank()

MsgHandle* comm_declare_send_rank ( void *  buffer,
int  rank,
int  tag,
size_t  nbytes 
)

Declare a message handle for sending nbytes to the rank with tag.

Definition at line 130 of file communicator_stack.cpp.

◆ comm_declare_strided_receive_displaced()

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

Create a persistent strided message handler for a displaced receive

Parameters
bufferBuffer into which message will be received
displacementArray of offsets specifying the relative node from which we are receiving
blksizeSize of block in bytes
nblocksNumber of blocks
strideStride between blocks in bytes

Definition at line 156 of file communicator_stack.cpp.

◆ comm_declare_strided_send_displaced()

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

Create a persistent strided message handler for a displaced send

Parameters
bufferBuffer from which message will be sent
displacementArray of offsets specifying the relative node to which we are sending
blksizeSize of block in bytes
nblocksNumber of blocks
strideStride between blocks in bytes

Definition at line 150 of file communicator_stack.cpp.

◆ comm_deterministic_reduce()

bool comm_deterministic_reduce ( )
Returns
Whether are doing determinisitic multi-process reductions or not

Definition at line 98 of file communicator_stack.cpp.

◆ comm_dim()

int comm_dim ( int  dim)

Return the number of processes in the dimension dim

Parameters
dimDimension which we are querying
Returns
Length of process dimensions

Definition at line 56 of file communicator_stack.cpp.

◆ comm_dim_partitioned()

int comm_dim_partitioned ( int  dim)

Definition at line 74 of file communicator_stack.cpp.

◆ comm_dim_partitioned_reset()

void comm_dim_partitioned_reset ( )

Definition at line 72 of file communicator_stack.cpp.

◆ comm_dim_partitioned_set()

void comm_dim_partitioned_set ( int  dim)

Definition at line 70 of file communicator_stack.cpp.

◆ comm_dim_partitioned_string()

const char* comm_dim_partitioned_string ( const int *  comm_dim_override = 0)

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

Parameters
comm_dim_overrideOptional override for partitioning
Returns
String specifying comm partitioning

Definition at line 82 of file communicator_stack.cpp.

◆ 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 78 of file communicator_stack.cpp.

◆ comm_enable_intranode()

void comm_enable_intranode ( bool  enable)

Enable / disable intra-node (non-peer-to-peer) communication.

Parameters
[in]enableBoolean flag to enable / disable intra-node (non peer-to-peer) communication

Definition at line 122 of file communicator_stack.cpp.

◆ comm_enable_peer2peer()

void comm_enable_peer2peer ( bool  enable)

Enable / disable peer-to-peer communication: used for dslash policies that do not presently support peer-to-peer communication.

Parameters
[in]enableBoolean flag to enable / disable peer-to-peer communication

Definition at line 118 of file communicator_stack.cpp.

◆ comm_finalize()

void comm_finalize ( void  )

Definition at line 68 of file communicator_stack.cpp.

◆ comm_free()

void comm_free ( MsgHandle *&  mh)

Definition at line 163 of file communicator_stack.cpp.

◆ 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 105 of file communicator_stack.cpp.

◆ 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 100 of file communicator_stack.cpp.

◆ comm_gdr_blacklist()

bool comm_gdr_blacklist ( )

Query if GPU Direct RDMA communication is blacklisted for this GPU.

Definition at line 126 of file communicator_stack.cpp.

◆ comm_gdr_enabled()

bool comm_gdr_enabled ( )

Query if GPU Direct RDMA communication is enabled (global setting)

Definition at line 124 of file communicator_stack.cpp.

◆ comm_gpuid()

int comm_gpuid ( void  )
Returns
GPU id associated with this process

Definition at line 96 of file communicator_stack.cpp.

◆ comm_init()

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

Initialize the communications, implemented in comm_single.cpp, comm_qmp.cpp, and comm_mpi.cpp.

Definition at line 62 of file communicator_stack.cpp.

◆ comm_intranode_enabled()

bool comm_intranode_enabled ( int  dir,
int  dim 
)

Query if intra-node (non-peer-to-peer) communication is enabled in a given dimension and direction

Parameters
dirDirection (0 - backwards, 1 forwards)
dimDimension (0-3)
Returns
Whether intra-node communication is enabled

Definition at line 120 of file communicator_stack.cpp.

◆ comm_neighbor_rank()

int comm_neighbor_rank ( int  dir,
int  dim 
)

Definition at line 54 of file communicator_stack.cpp.

◆ comm_nvshmem_enabled()

bool comm_nvshmem_enabled ( )

Query if NVSHMEM communication is enabled (global setting)

Definition at line 128 of file communicator_stack.cpp.

◆ comm_partitioned()

int comm_partitioned ( )

Loop over comm_dim_partitioned(dim) for all comms dimensions.

Returns
Whether any communications dimensions are partitioned

Definition at line 76 of file communicator_stack.cpp.

◆ comm_peer2peer_enabled()

bool comm_peer2peer_enabled ( int  dir,
int  dim 
)

Query if peer-to-peer communication is enabled

Parameters
dirDirection (0 - backwards, 1 forwards)
dimDimension (0-3)
Returns
Whether peer-to-peer is enabled

Definition at line 116 of file communicator_stack.cpp.

◆ comm_peer2peer_enabled_global()

int comm_peer2peer_enabled_global ( )

Query what peer-to-peer communication is enabled globally

Returns
2-bit number reporting 1 for copy engine, 2 for remote writes

Definition at line 114 of file communicator_stack.cpp.

◆ comm_peer2peer_init()

void comm_peer2peer_init ( const char *  hostname_recv_buf)

Enabled peer-to-peer communication.

Parameters
hostname_bufArray that holds all process hostnames

Definition at line 107 of file communicator_stack.cpp.

◆ comm_peer2peer_present()

bool comm_peer2peer_present ( )

Returns true if any peer-to-peer capability is present on this system (regardless of whether it has been disabled or not. We use this, for example, to determine if we need to allocate pinned device memory or not.

Definition at line 112 of file communicator_stack.cpp.

◆ comm_query()

int comm_query ( MsgHandle mh)

Definition at line 169 of file communicator_stack.cpp.

◆ comm_rank()

int comm_rank ( void  )
Returns
Rank id of this process

Definition at line 87 of file communicator_stack.cpp.

◆ comm_rank_from_coords()

int comm_rank_from_coords ( const int *  coords)

Definition at line 60 of file communicator_stack.cpp.

◆ comm_rank_global()

int comm_rank_global ( void  )
Returns
the default rank id of this process. This doesn't go through the communicator route, so it can be called without initializing the communicator stack.

Definition at line 89 of file communicator_stack.cpp.

◆ comm_size()

int comm_size ( void  )
Returns
Number of processes

Definition at line 91 of file communicator_stack.cpp.

◆ comm_start()

void comm_start ( MsgHandle mh)

Definition at line 165 of file communicator_stack.cpp.

◆ comm_wait()

void comm_wait ( MsgHandle mh)

Definition at line 167 of file communicator_stack.cpp.

◆ commAsyncReduction()

bool commAsyncReduction ( )

Definition at line 216 of file communicator_stack.cpp.

◆ commAsyncReductionSet()

void commAsyncReductionSet ( bool  global_reduce)

Definition at line 218 of file communicator_stack.cpp.

◆ commCoords()

int commCoords ( int  dim)

Definition at line 204 of file communicator_stack.cpp.

◆ commDim()

int commDim ( int  dim)

Definition at line 202 of file communicator_stack.cpp.

◆ commDimPartitioned()

int commDimPartitioned ( int  dir)

Definition at line 206 of file communicator_stack.cpp.

◆ commDimPartitionedReset()

void commDimPartitionedReset ( )

Reset the comm dim partioned array to zero,.

This should only be needed for automated testing when different partitioning is applied within a single run.

Definition at line 210 of file communicator_stack.cpp.

◆ commDimPartitionedSet()

void commDimPartitionedSet ( int  dir)

Definition at line 208 of file communicator_stack.cpp.

◆ commGlobalReduction()

bool commGlobalReduction ( )

Definition at line 212 of file communicator_stack.cpp.

◆ commGlobalReductionSet()

void commGlobalReductionSet ( bool  global_reduce)

Definition at line 214 of file communicator_stack.cpp.

◆ finalize_communicator_stack()

void finalize_communicator_stack ( )

Definition at line 22 of file communicator_stack.cpp.

◆ get_current_communicator()

Communicator& get_current_communicator ( )

Definition at line 31 of file communicator_stack.cpp.

◆ get_enable_p2p_max_access_rank()

int get_enable_p2p_max_access_rank ( )

Definition at line 220 of file communicator_stack.cpp.

◆ init_communicator_stack()

void init_communicator_stack ( int  ndim,
const int *  dims,
QudaCommsMap  rank_from_coords,
void *  map_data,
bool  user_set_comm_handle,
void *  user_comm 
)

Definition at line 12 of file communicator_stack.cpp.

◆ push_communicator()

void push_communicator ( const quda::CommKey split_key)

Definition at line 38 of file communicator_stack.cpp.

◆ reduceDouble()

void reduceDouble ( double &  sum)

Definition at line 198 of file communicator_stack.cpp.

◆ reduceDoubleArray()

void reduceDoubleArray ( double *  max,
const int  len 
)

Definition at line 200 of file communicator_stack.cpp.

◆ reduceMaxDouble()

void reduceMaxDouble ( double &  max)

Definition at line 196 of file communicator_stack.cpp.