Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 34 additions & 21 deletions src/collective/tests/test_alltoallv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,56 @@ int main(int argc, char** argv)

// Test Integer Alltoall
int max_i = 10;
int max_s = pow(2, max_i);
srand(time(NULL));
int max_s = 2 << max_i;
std::vector<int> local_data(max_s*num_procs);

std::vector<int> pmpi_alltoallv(max_s*num_procs);
std::vector<int> mpix_alltoallv(max_s*num_procs);

std::vector<int> sizes(num_procs);
std::vector<int> displs(num_procs+1);
std::vector<int> sendcounts(num_procs);
std::vector<int> sdispls(num_procs);

MPIX_Comm* xcomm;
MPIX_Comm_init(&xcomm, MPI_COMM_WORLD);
update_locality(xcomm, 4);
std::vector<int> recvcounts(num_procs);
std::vector<int> rdispls(num_procs);

for (int i = 0; i < max_i; i++)
//MPIX_Comm* xcomm;
//MPIX_Comm_init(&xcomm, MPI_COMM_WORLD);
//update_locality(xcomm, 4);

//for (int i = 0; i < max_i; i++)
{
int s = pow(2, i);
int s = 1 << max_i;

// Will only be clean for up to double digit process counts
displs[0] = 0;
for (int j = 0; j < num_procs; j++)
{
for (int k = 0; k < s; k++)
local_data[j*s + k] = rank*10000 + j*100 + k;
sizes[j] = s;
displs[j+1] = displs[j] + s;
sendcounts[j] = s;
recvcounts[j] = s;
}

sdispls[0] = 0;
rdispls[0] = 0;
for (int j = 1; j < num_procs; j++)
{
sdispls[j] = sdispls[j-1] + s;
rdispls[j] = rdispls[j-1] + s;
}

PMPI_Alltoallv(local_data.data(),
sizes.data(),
displs.data(),

MPI_Alltoallv(local_data.data(),
sendcounts.data(),
sdispls.data(),
MPI_INT,
pmpi_alltoallv.data(),
sizes.data(),
displs.data(),
recvcounts.data(),
rdispls.data(),
MPI_INT,
MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);

/*

std::fill(mpix_alltoallv.begin(), mpix_alltoallv.end(), 0);
MPIX_Alltoallv(local_data.data(),
sizes.data(),
Expand All @@ -83,7 +94,8 @@ int main(int argc, char** argv)
MPI_INT,
xcomm);
compare_alltoallv_results(pmpi_alltoallv, mpix_alltoallv, s);



std::fill(mpix_alltoallv.begin(), mpix_alltoallv.end(), 0);
alltoallv_pairwise(local_data.data(),
sizes.data(),
Expand All @@ -108,6 +120,7 @@ int main(int argc, char** argv)
xcomm);
compare_alltoallv_results(pmpi_alltoallv, mpix_alltoallv, s);


std::fill(mpix_alltoallv.begin(), mpix_alltoallv.end(), 0);
alltoallv_batch(local_data.data(),
sizes.data(),
Expand All @@ -131,10 +144,10 @@ int main(int argc, char** argv)
MPI_INT,
xcomm);
compare_alltoallv_results(pmpi_alltoallv, mpix_alltoallv, s);

*/
}

MPIX_Comm_free(&xcomm);
//MPIX_Comm_free(&xcomm);


MPI_Finalize();
Expand Down
Loading