MPI Reduce with memory constraint. MPI_Reduce may give a segmentation fault when sharing large objects
342 MPI_Type_size(datatype,&type_size);
343 size_t quotient=count/blockSize;
346 for (
size_t c=0;
c<quotient;
c++)
347 MPI_Reduce((
unsigned char*)(send_data)+
c*blockSize*
size_t(type_size),
348 (
unsigned char*)(recv_data)+
c*blockSize*
size_t(type_size),
349 blockSize,datatype,op,root,communicator);
351 size_t remainder=count%blockSize;
353 MPI_Reduce((
unsigned char*)(send_data)+quotient*blockSize*
size_t(type_size),
354 (
unsigned char*)(recv_data)+quotient*blockSize*
size_t(type_size),
355 remainder,datatype,op,root,communicator);