From f16bc9f7a9ec9ea4d6b61024fb9920503650aad1 Mon Sep 17 00:00:00 2001 From: Gaurav Dhingra Date: Fri, 21 Mar 2025 13:20:24 +0530 Subject: [PATCH] test: add test for MPI_Barrier --- tests/barrier_1.f90 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/barrier_1.f90 diff --git a/tests/barrier_1.f90 b/tests/barrier_1.f90 new file mode 100644 index 0000000..5406c75 --- /dev/null +++ b/tests/barrier_1.f90 @@ -0,0 +1,22 @@ +program barrier_1 + use mpi + implicit none + + integer :: rank, size, ierr + + ! Initialize MPI + call MPI_Init(ierr) + + call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr) + call MPI_Comm_size(MPI_COMM_WORLD, size, ierr) + + print *, "Process ", rank, " reached before the barrier." + + ! Synchronize all processes at this point + call MPI_Barrier(MPI_COMM_WORLD, ierr) + + print *, "Process ", rank, " passed the barrier." + + call MPI_Finalize(ierr) + +end program