Skip to content

Commit

Permalink
TEST: local check for colls (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev authored Dec 8, 2023
1 parent e3c4ee2 commit dea8087
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
4 changes: 4 additions & 0 deletions test/mpi/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,10 @@ int main(int argc, char *argv[])
"a problem\n";
failed = 1;
}

if (total_done_skipped_failed[3] != 0) {
failed = 1;
}
}

test_exit:
Expand Down
4 changes: 3 additions & 1 deletion test/mpi/test_allgather.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ ucc_status_t TestAllgather::check()
dt_size = ucc_dt_size(dt);
for (i = 0; i < size; i++) {
init_buffer(PTR_OFFSET(check_buf, i * single_rank_count * dt_size),
single_rank_count, dt, mem_type, i * (iter_persistent + 1));
single_rank_count, dt, UCC_MEMORY_TYPE_HOST,
i * (iter_persistent + 1));
}


return compare_buffers(rbuf, check_buf, single_rank_count * size, dt,
mem_type);
}
27 changes: 11 additions & 16 deletions test/mpi/test_allgatherv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ ucc_status_t TestAllgatherv::set_input(int iter_persistent)
{
size_t dt_size = ucc_dt_size(dt);
int rank;
void *buf, *check;
void *buf;

this->iter_persistent = iter_persistent;
MPI_Comm_rank(team.comm, &rank);
if (inplace) {
buf = PTR_OFFSET(rbuf, displacements[rank] * dt_size);
} else {
buf = sbuf;
}
check = PTR_OFFSET(check_buf, displacements[rank] * dt_size);
init_buffer(buf, counts[rank], dt, mem_type, rank * (iter_persistent + 1));
UCC_CHECK(ucc_mc_memcpy(check, buf, counts[rank] * dt_size,
UCC_MEMORY_TYPE_HOST, mem_type));

return UCC_OK;
}

Expand All @@ -108,23 +107,19 @@ TestAllgatherv::~TestAllgatherv() {

ucc_status_t TestAllgatherv::check()
{
MPI_Datatype mpi_dt = ucc_dt_to_mpi(dt);
int total_count = 0;
int size, rank, completed, i;
MPI_Request req;
int total_count = 0;
int size, i;

MPI_Comm_size(team.comm, &size);
MPI_Comm_rank(team.comm, &rank);
for (i = 0 ; i < size; i++) {
total_count += counts[i];
}
MPI_Iallgatherv(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, check_buf,
(int *)counts, (int *)displacements, mpi_dt, team.comm,
&req);
do {
MPI_Test(&req, &completed, MPI_STATUS_IGNORE);
ucc_context_progress(team.ctx);
} while(!completed);

for (i = 0; i < size; i++) {
init_buffer(PTR_OFFSET(check_buf, displacements[i] * ucc_dt_size(dt)),
counts[i], dt, UCC_MEMORY_TYPE_HOST,
i * (iter_persistent + 1));
}

return compare_buffers(rbuf, check_buf, total_count, dt, mem_type);
}
6 changes: 3 additions & 3 deletions test/mpi/test_alltoall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ ucc_status_t TestAlltoall::check()
MPI_Comm_size(team.comm, &size);
single_rank_count = args.src.info.count / size;

for ( i = 0; i < size; i++) {
for (i = 0; i < size; i++) {
init_buffer(PTR_OFFSET(check_buf, i * single_rank_count * ucc_dt_size(dt)),
single_rank_count, dt, mem_type, i * (iter_persistent + 1),
single_rank_count * rank);
single_rank_count, dt, UCC_MEMORY_TYPE_HOST,
i * (iter_persistent + 1), single_rank_count * rank);
}

return compare_buffers(rbuf, check_buf, single_rank_count * size, dt,
Expand Down
27 changes: 15 additions & 12 deletions test/mpi/test_alltoallv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ TestAlltoallv::TestAlltoallv(ucc_test_team_t &_team, TestCaseParams &params) :
if (TEST_SKIP_NONE != skip_reduce(test_skip, team.comm)) {
return;
}
check_buf = ucc_malloc((sncounts + rncounts) * dt_size, "check buf");
check_buf = ucc_malloc(rncounts * dt_size, "check buf");
UCC_MALLOC_CHECK(check_buf);

if (!is_onesided) {
Expand Down Expand Up @@ -184,13 +184,11 @@ TestAlltoallv::TestAlltoallv(ucc_test_team_t &_team, TestCaseParams &params) :

ucc_status_t TestAlltoallv::set_input(int iter_persistent)
{
size_t dt_size = ucc_dt_size(dt);
int rank;
int rank;

this->iter_persistent = iter_persistent;
MPI_Comm_rank(team.comm, &rank);
init_buffer(sbuf, sncounts, dt, mem_type, rank * (iter_persistent + 1));
UCC_CHECK(ucc_mc_memcpy(check_buf, sbuf, sncounts * dt_size,
UCC_MEMORY_TYPE_HOST, mem_type));

return UCC_OK;
}
Expand All @@ -209,20 +207,25 @@ TestAlltoallv::~TestAlltoallv()

ucc_status_t TestAlltoallv::check()
{
size_t dt_size = ucc_dt_size(dt);
MPI_Request req;
int completed;
void *check;
int i, size, rank, completed;

check = PTR_OFFSET(check_buf, sncounts * dt_size);
MPI_Ialltoallv(check_buf, scounts, sdispls, ucc_dt_to_mpi(dt), check,
rcounts, rdispls, ucc_dt_to_mpi(dt), team.comm, &req);
MPI_Comm_size(team.comm, &size);
MPI_Comm_rank(team.comm, &rank);

MPI_Ialltoall(sdispls, 1, MPI_INT, scounts, 1, MPI_INT, team.comm, &req);
do {
MPI_Test(&req, &completed, MPI_STATUS_IGNORE);
ucc_context_progress(team.ctx);
} while(!completed);

return compare_buffers(rbuf, check, rncounts, dt, mem_type);
for (i = 0; i < size; i++) {
init_buffer(PTR_OFFSET(check_buf, rdispls[i] * ucc_dt_size(dt)),
rcounts[i], dt, UCC_MEMORY_TYPE_HOST,
i * (iter_persistent + 1), scounts[i]);
}

return compare_buffers(rbuf, check_buf, rncounts, dt, mem_type);
}

std::string TestAlltoallv::str()
Expand Down

0 comments on commit dea8087

Please sign in to comment.