Initialize the environment. This routine is called by tem_start which should be the very first action in a program.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_comm_env_type) | :: | proc |
The process communicator type |
|||
integer, | intent(in), | optional | :: | comm |
mpi communicator if it is predefined as in apesmate |
subroutine tem_comm_env_init( proc, comm ) ! --------------------------------------------------------------------------= !> The process communicator type type( tem_comm_env_type ) :: proc !> mpi communicator if it is predefined as in apesmate integer, intent(in), optional :: comm ! --------------------------------------------------------------------------- !> Error flag integer :: iError ! -------------------------------------------------------------------------- proc%nThreads = 1 !$ proc%nThreads = omp_get_max_threads() ! Init MPI rank, size and root ! if communicator is predefiend and passed use that one ! else default to mpi_comm_world if(present(comm)) then proc%comm = comm else !KM: with this call proc%comm must be freed by mpi_comm_free !so directly setting proc%comm = MPI_COMM_WORLD !call mpi_comm_dup( mpi_comm_world, proc%comm, iError ) proc%comm = mpi_comm_world endif call mpi_comm_rank( proc%comm, proc%rank, iError ) call mpi_comm_size( proc%comm, proc%comm_size, iError ) proc%root = 0 if ( proc%rank == proc%root ) then proc%isRoot = .true. else proc%isRoot = .false. end if end subroutine tem_comm_env_init