Grid 0.7.0
Communicator_none.cc
Go to the documentation of this file.
1/*************************************************************************************
2
3 Grid physics library, www.github.com/paboyle/Grid
4
5 Source file: ./lib/communicator/Communicator_none.cc
6
7 Copyright (C) 2015
8
9Author: Peter Boyle <paboyle@ph.ed.ac.uk>
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 See the full license in the file "LICENSE" in the top level distribution directory
26*************************************************************************************/
27/* END LEGAL */
28#include <Grid/GridCore.h>
29
31
33// Info that is setup once and indept of cartesian layout
36
37void CartesianCommunicator::Init(int *argc, char *** arv)
38{
43}
44
45CartesianCommunicator::CartesianCommunicator(const Coordinate &processors,const CartesianCommunicator &parent,int &srank)
46 : CartesianCommunicator(processors)
47{
48 _shm_processors = Coordinate(processors.size(),1);
49 srank=0;
50 SetCommunicator(communicator_world);
51}
52
54{
55 _shm_processors = Coordinate(processors.size(),1);
56 _processors = processors;
57 _ndimension = processors.size(); assert(_ndimension>=1);
59
60 // Require 1^N processor grid for fake
62 _processor = 0;
63 for(int d=0;d<_ndimension;d++) {
64 assert(_processors[d]==1);
65 _processor_coor[d] = 0;
66 }
68}
69
71
77void CartesianCommunicator::GlobalSumVector(double *,int N){}
78void CartesianCommunicator::GlobalSum(uint32_t &){}
79void CartesianCommunicator::GlobalSum(uint64_t &){}
80void CartesianCommunicator::GlobalSumVector(uint64_t *,int N){}
81void CartesianCommunicator::GlobalXOR(uint32_t &){}
82void CartesianCommunicator::GlobalXOR(uint64_t &){}
83
84
85// Basic Halo comms primitive -- should never call in single node
87 int dest,
88 void *recv,
89 int from,
90 int bytes)
91{
92 assert(0);
93}
94void CartesianCommunicator::CommsComplete(std::vector<CommsRequest_t> &list){ assert(list.size()==0);}
95void CartesianCommunicator::SendToRecvFromBegin(std::vector<CommsRequest_t> &list,
96 void *xmit,
97 int dest,
98 void *recv,
99 int from,
100 int bytes,int dir)
101{
102 assert(0);
103}
104
105void CartesianCommunicator::AllToAll(int dim,void *in,void *out,uint64_t words,uint64_t bytes)
106{
107 bcopy(in,out,bytes*words);
108}
109void CartesianCommunicator::AllToAll(void *in,void *out,uint64_t words,uint64_t bytes)
110{
111 bcopy(in,out,bytes*words);
112}
113
114int CartesianCommunicator::RankWorld(void){return 0;}
116void CartesianCommunicator::Broadcast(int root,void* data, int bytes) {}
117void CartesianCommunicator::BroadcastWorld(int root,void* data, int bytes) { }
121void CartesianCommunicator::ShiftedRanks(int dim,int shift,int &source,int &dest)
122{
123 source =0;
124 dest=0;
125}
126
127int CartesianCommunicator::IsOffNode(int rank) { return false; }
128
130 int xmit_to_rank,int dox,
131 void *recv,
132 int recv_from_rank,int dor,
133 int bytes, int dir)
134{
135 return 2.0*bytes;
136}
137void CartesianCommunicator::StencilSendToRecvFromPollIRecv(std::vector<CommsRequest_t> &list) {};
138void CartesianCommunicator::StencilSendToRecvFromPollDtoH(std::vector<CommsRequest_t> &list) {};
139double CartesianCommunicator::StencilSendToRecvFromPrepare(std::vector<CommsRequest_t> &list,
140 void *xmit,
141 int xmit_to_rank,int dox,
142 void *recv,
143 int recv_from_rank,int dor,
144 int xbytes,int rbytes, int dir)
145{
146 return 0.0;
147}
148double CartesianCommunicator::StencilSendToRecvFromBegin(std::vector<CommsRequest_t> &list,
149 void *xmit, void *xmit_comp,
150 int xmit_to_rank,int dox,
151 void *recv, void *recv_comp,
152 int recv_from_rank,int dor,
153 int xbytes,int rbytes, int dir)
154{
155 return xbytes+rbytes;
156}
157void CartesianCommunicator::StencilSendToRecvFromComplete(std::vector<CommsRequest_t> &waitall,int dir)
158{
159}
160
162
164
165
AcceleratorVector< int, MaxDims > Coordinate
Definition Coordinate.h:95
#define NAMESPACE_BEGIN(A)
Definition Namespace.h:35
#define NAMESPACE_END(A)
Definition Namespace.h:36
int Grid_MPI_Comm
accelerator_inline size_type size(void) const
Definition Coordinate.h:52
double StencilSendToRecvFromPrepare(std::vector< CommsRequest_t > &list, void *xmit, int xmit_to_rank, int do_xmit, void *recv, int recv_from_rank, int do_recv, int xbytes, int rbytes, int dir)
void ProcessorCoorFromRank(int rank, Coordinate &coor)
CartesianCommunicator(const Coordinate &processors, const CartesianCommunicator &parent, int &srank)
void StencilSendToRecvFromComplete(std::vector< CommsRequest_t > &waitall, int i)
void Broadcast(int root, void *data, int bytes)
void StencilSendToRecvFromPollDtoH(std::vector< CommsRequest_t > &list)
static void Init(int *argc, char ***argv)
double StencilSendToRecvFrom(void *xmit, int xmit_to_rank, int do_xmit, void *recv, int recv_from_rank, int do_recv, int bytes, int dir)
void AllToAll(int dim, std::vector< T > &in, std::vector< T > &out)
void StencilSendToRecvFromPollIRecv(std::vector< CommsRequest_t > &list)
double StencilSendToRecvFromBegin(std::vector< CommsRequest_t > &list, void *xmit, void *xmit_comp, int xmit_to_rank, int do_xmit, void *recv, void *recv_comp, int recv_from_rank, int do_recv, int xbytes, int rbytes, int dir)
static void BarrierWorld(void)
void CommsComplete(std::vector< MpiCommsRequest_t > &list)
void GlobalSumVector(RealF *, int N)
void SendToRecvFrom(void *xmit, int xmit_to_rank, void *recv, int recv_from_rank, int bytes)
int RankFromProcessorCoor(Coordinate &coor)
static Grid_MPI_Comm communicator_world
static void BroadcastWorld(int root, void *data, int bytes)
void SendToRecvFromBegin(std::vector< MpiCommsRequest_t > &list, void *xmit, int dest, void *recv, int from, int bytes, int dir)
void ShiftedRanks(int dim, int shift, int &source, int &dest)
static void SharedMemoryAllocate(uint64_t bytes, int flags)
static void Init(Grid_MPI_Comm comm)
static uint64_t MAX_MPI_SHM_BYTES
void SetCommunicator(Grid_MPI_Comm comm)