Skip to content

Commit

Permalink
test: add stream workq tests
Browse files Browse the repository at this point in the history
Add stream workq tests by setting MPIR_CVAR_CH4_ENABLE_STREAM_WORKQ and
command line option -progress-thread.
  • Loading branch information
hzhou committed Jul 21, 2022
1 parent df052f5 commit b3606df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/mpi/impls/mpich/cuda/stream.cu
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,22 @@ void saxpy(int n, float a, float *x, float *y)
if (i < n) y[i] = a*x[i] + y[i];
}

int main(void)
static int need_progress_thread = 0;
static void parse_args(int argc, char **argv)
{
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-progress-thread") == 0) {
need_progress_thread = 1;
}
}
}

int main(int argc, char **argv)
{
int errs = 0;

parse_args(argc, argv);

cudaStream_t stream;
cudaStreamCreate(&stream);

Expand Down Expand Up @@ -71,6 +83,10 @@ int main(void)

MPI_Info_free(&info);

if (need_progress_thread) {
MPIX_Start_progress_thread(mpi_stream);
}

MPI_Comm stream_comm;
MPIX_Stream_comm_create(MPI_COMM_WORLD, mpi_stream, &stream_comm);

Expand Down Expand Up @@ -139,6 +155,9 @@ int main(void)
errs += check_result(y);
}

if (need_progress_thread) {
MPIX_Stop_progress_thread(mpi_stream);
}

MPI_Comm_free(&stream_comm);
MPIX_Stream_free(&mpi_stream);
Expand Down
1 change: 1 addition & 0 deletions test/mpi/impls/mpich/cuda/testlist
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
saxpy 2
stream 2 env=MPIR_CVAR_CH4_RESERVE_VCIS=1
stream 2 env=MPIR_CVAR_CH4_RESERVE_VCIS=1 env=MPIR_CVAR_CH4_ENABLE_STREAM_WORKQ=1 env=MPIR_CVAR_GPU_HAS_WAIT_KERNEL=1 arg=-progress_thread
stream_allred 4 env=MPIR_CVAR_CH4_RESERVE_VCIS=1

0 comments on commit b3606df

Please sign in to comment.