|
5 | 5 | !> Contains a type to deal with the mpi environment |
6 | 6 | module fortuno_mpi_mpienv |
7 | 7 | use mpi_f08, only : MPI_Allreduce, MPI_CHAR, MPI_Comm, MPI_Comm_rank, MPI_Comm_size,& |
8 | | - & MPI_COMM_WORLD, MPI_IN_PLACE, MPI_Init, MPI_INTEGER, MPI_Finalize, MPI_PROD, MPI_Recv,& |
9 | | - & MPI_Send, MPI_Status |
| 8 | + & MPI_COMM_WORLD, MPI_IN_PLACE, MPI_Init_thread, MPI_INTEGER, MPI_Finalize, MPI_PROD, MPI_Recv,& |
| 9 | + & MPI_Send, MPI_Status, MPI_THREAD_MULTIPLE |
10 | 10 | implicit none |
11 | 11 |
|
12 | 12 | private |
@@ -34,15 +34,18 @@ module fortuno_mpi_mpienv |
34 | 34 | contains |
35 | 35 |
|
36 | 36 | !> Initializes the MPI environment |
| 37 | + !! |
| 38 | + !! Full threading support with MPI is requested to maximize support |
| 39 | + !! for client codes. |
37 | 40 | subroutine init_mpi_env(this) |
38 | 41 |
|
39 | 42 | !> Instance |
40 | 43 | type(mpi_env), intent(out) :: this |
41 | 44 |
|
42 | | - integer :: ierror |
| 45 | + integer :: ierror, provided |
43 | 46 |
|
44 | | - call MPI_Init(ierror) |
45 | | - if (ierror /= 0) error stop "MPI_Init failed in init_mpi_env" |
| 47 | + call MPI_Init_thread(MPI_THREAD_MULTIPLE, provided) |
| 48 | + if (ierror /= 0) error stop "MPI_Init_thread failed in init_mpi_env" |
46 | 49 | this%comm = MPI_COMM_WORLD |
47 | 50 | call MPI_Comm_size(this%comm, this%nranks, ierror) |
48 | 51 | if (ierror /= 0) error stop "MPI_Comm_size failed in init_mpi_env" |
|
0 commit comments