Commit d18005ca authored by Volker Springel's avatar Volker Springel
Browse files

remove limit of 2GB in transfer of sorted data

parent b04de6f7
......@@ -456,16 +456,10 @@ inline double mycxxsort_parallel(T *begin, T *end, Comp comp, MPI_Comm comm)
/* At this point we have found all the elements corresponding to the desired split points */
/* we can now go ahead and determine how many elements of the local CPU have to go to each other CPU */
if(nmemb * size > (1LL << 31))
Terminate("currently, local data must be smaller than 2 GB");
/* note: to restrict this limitation, the send/recv count arrays have to made 64-bit,
* and the MPI data exchange though MPI_Alltoall has to be modified such that buffers > 2 GB become possible
*/
int *send_count = (int *)Mem.mymalloc("send_count", Local_NTask * sizeof(int));
int *recv_count = (int *)Mem.mymalloc("recv_count", Local_NTask * sizeof(int));
int *send_offset = (int *)Mem.mymalloc("send_offset", Local_NTask * sizeof(int));
int *recv_offset = (int *)Mem.mymalloc("recv_offset", Local_NTask * sizeof(int));
size_t *send_count = (size_t *)Mem.mymalloc("send_count", Local_NTask * sizeof(size_t));
size_t *recv_count = (size_t *)Mem.mymalloc("recv_count", Local_NTask * sizeof(size_t));
size_t *send_offset = (size_t *)Mem.mymalloc("send_offset", Local_NTask * sizeof(size_t));
size_t *recv_offset = (size_t *)Mem.mymalloc("recv_offset", Local_NTask * sizeof(size_t));
for(int i = 0; i < Local_NTask; i++)
send_count[i] = 0;
......@@ -492,7 +486,7 @@ inline double mycxxsort_parallel(T *begin, T *end, Comp comp, MPI_Comm comm)
send_count[target]++;
}
MPI_Alltoall(send_count, 1, MPI_INT, recv_count, 1, MPI_INT, MPI_CommLocal);
MPI_Alltoall(send_count, sizeof(size_t), MPI_BYTE, recv_count, sizeof(size_t), MPI_BYTE, MPI_CommLocal);
size_t nimport = 0;
......@@ -524,7 +518,7 @@ inline double mycxxsort_parallel(T *begin, T *end, Comp comp, MPI_Comm comm)
T *basetmp = (T *)Mem.mymalloc("basetmp", nmemb * size);
/* exchange the data */
MPI_Alltoallv(begin, send_count, send_offset, MPI_BYTE, basetmp, recv_count, recv_offset, MPI_BYTE, MPI_CommLocal);
myMPI_Alltoallv(begin, send_count, send_offset, basetmp, recv_count, recv_offset, sizeof(char), 1, MPI_CommLocal);
memcpy(static_cast<void *>(begin), static_cast<void *>(basetmp), nmemb * size);
Mem.myfree(basetmp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment