From 42be16a685336774d60affa3b77437baf45fdef2 Mon Sep 17 00:00:00 2001 From: Andreas Herten <a.herten@fz-juelich.de> Date: Sat, 17 Jun 2023 14:32:38 +0200 Subject: [PATCH] Implement TODOs --- 02-MSA-hello-world-gpu/hello-world.c | 5 +++++ 02-MSA-hello-world-gpu/hello-world.cu | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/02-MSA-hello-world-gpu/hello-world.c b/02-MSA-hello-world-gpu/hello-world.c index 9d501bc..89fcd00 100644 --- a/02-MSA-hello-world-gpu/hello-world.c +++ b/02-MSA-hello-world-gpu/hello-world.c @@ -24,8 +24,13 @@ int main(int argc, char** argv){ const char *payload = "world!"; + // TODO: Implement the MPI_Send call to send the six characters of "payload" to rank 1 if (rank == 0) { + #ifdef SOLUTION MPI_Send(payload, 6, MPI_CHAR, 1, tag, MPI_COMM_WORLD); + #else + MPI_Send(); + #endif } printf("\n"); diff --git a/02-MSA-hello-world-gpu/hello-world.cu b/02-MSA-hello-world-gpu/hello-world.cu index da1b592..8c71020 100644 --- a/02-MSA-hello-world-gpu/hello-world.cu +++ b/02-MSA-hello-world-gpu/hello-world.cu @@ -51,8 +51,13 @@ int main(int argc, char** argv){ CUDA_RT_CALL( cudaPeekAtLastError() ); CUDA_RT_CALL( cudaDeviceSynchronize() ); + // TODO: Implement the MPI_Recv() call to receive the "payload" from rank 1 using directly "d_payload" as the target buffer on the GPU if (rank == 1) { + #ifdef SOLUTION MPI_Recv(d_payload, 6, MPI_CHAR, 0, tag, MPI_COMM_WORLD, &stat); + #else + MPI_Recv(); + #endif } hello<<<1, 1>>>(d_payload); -- GitLab