23 return inputT.linearSize();
27 void linearIn(T& a_outputT,
const void*
const inBuf)
29 a_outputT.linearIn(inBuf);
33 void linearOut(
void*
const a_outBuf,
const T& inputT)
35 inputT.linearOut(a_outBuf);
68 void* sendBuf =
static_cast<void*
>(&isize);
72 vectSize =
new int[nProcess];
73 vectDisp =
new int[nProcess];
76 int result1 = MPI_Gather(sendBuf, sendCount, MPI_INT,
77 vectSize,recdCount, MPI_INT,
78 a_dest, Chombo_MPI::comm);
80 if (result1 != MPI_SUCCESS)
88 for (
int iproc = 0; iproc < nProcess; iproc++)
90 vectDisp[iproc] = itotsize;
91 itotsize += vectSize[iproc];
101 int result2 = MPI_Gatherv(loclBuf, isize, MPI_BYTE,
102 recdBuf, vectSize, vectDisp, MPI_BYTE,
103 a_dest, Chombo_MPI::comm);
104 if (result2 != MPI_SUCCESS)
111 a_outVec.
resize(nProcess);
113 char* arithPtr = (
char*)recdBuf;
114 for (
int iproc = 0; iproc < nProcess; iproc++)
116 ioffset = vectDisp[iproc];
117 char* thisProcBuf = arithPtr + ioffset;
118 linearIn(a_outVec[iproc], thisProcBuf);
146 MPI_Bcast(&isize, 1, MPI_INT, a_src, Chombo_MPI::comm);
150 if (broadBuf == NULL)
162 MPI_Bcast(broadBuf, isize, MPI_BYTE, a_src, Chombo_MPI::comm);
188 MPI_Barrier(Chombo_MPI::comm);
200 a_outVec[0] = a_input;
220 #endif //the mpi thing 232 const int*
const intBuf = (
int*)a_inBuf;
233 int vecsize = intBuf[0];
236 for (
int ivec = 0; ivec < vecsize; ivec++)
238 vecOffset[ivec] = intBuf[ivec+1];
246 a_outputT.
resize(vecsize);
247 const char*
const charbuf = (
char*)a_inBuf;
248 for (
int ivec = 0; ivec < vecsize; ivec++)
250 const char*
const dataLoc = charbuf + vecOffset[ivec];
261 int*
const intBuf = (
int*)a_outBuf;
262 intBuf[0] = a_input.
size();
263 int vecsize = intBuf[0];
267 int ioffset = (vecsize+1)*
sizeof(
int);
268 for (
int ivec = 0; ivec < vecsize; ivec++)
270 intBuf[ivec+1] = ioffset;
271 vecOffset[ivec] = ioffset;
279 char*
const charBuf = (
char*)a_outBuf;
280 for (
int ivec = 0; ivec < vecsize; ivec++)
282 char*
const dataLoc = charBuf + vecOffset[ivec];
295 int itotsize = (a_input.
size() + 1)*
sizeof(
int);
296 for (
unsigned int ivec = 0; ivec < a_input.
size(); ivec++)
#define freeMT(a_a)
Definition: memtrack.H:160
#define CH_assert(cond)
Definition: CHArray.H:37
void linearOut(void *const a_outBuf, const T &inputT)
Definition: SPMDI.H:33
void barrier(void)
all ranks wait here to sync-up
Definition: SPMDI.H:215
one dimensional dynamic array
Definition: Vector.H:53
#define mallocMT(a_a)
Definition: memtrack.H:159
void AttachDebugger(int a_sig=4)
void linearIn(T &a_outputT, const void *const inBuf)
Definition: SPMDI.H:27
unsigned long long CH_MaxMPIRecvSize
unsigned long long CH_MaxMPISendSize
unsigned int numProc()
number of parallel processes
int linearSize(const T &inputT)
Definition: SPMDI.H:21
void resize(unsigned int isize)
Definition: Vector.H:346
void gather(Vector< T > &a_outVec, const T &a_input, int a_dest)
Definition: SPMDI.H:197
void linearListIn(Vector< T > &a_outputT, const void *const a_inBuf)
Definition: SPMDI.H:229
size_t size() const
Definition: Vector.H:192
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
void linearListOut(void *const a_outBuf, const Vector< T > &a_input)
Definition: SPMDI.H:258
int linearListSize(const Vector< T > &a_input)
Definition: SPMDI.H:290
int procID()
local process ID
void broadcast(T &a_inAndOut, int a_src)
broadcast to every process
Definition: SPMDI.H:207