YAC 3.18.0
Yet Another Coupler
Loading...
Searching...
No Matches
test_init_comm_final.F90
Go to the documentation of this file.
1! Copyright (c) 2024 The YAC Authors
2!
3! SPDX-License-Identifier: BSD-3-Clause
4
8
9#include "test_macros.inc"
10
12
13 use utest
14 use yac
15 use mpi
16
17 implicit none
18
19 integer :: comp_id
20 integer :: npes, mype, couple_npes, comp_npes
21 integer :: ierror
22 integer :: couple_communicator, comp_communicator
23
24 call start_test("yac_finit and yac_ffinalize")
25
26 call mpi_init(ierror)
27
28 call mpi_comm_rank(mpi_comm_world, mype, ierror)
29 call mpi_comm_size(mpi_comm_world, npes, ierror)
30 call test(npes == 6)
31
32 if (mype < 5) then
33
34 call mpi_comm_split(mpi_comm_world, 0, 0, couple_communicator, ierror)
35
36 call mpi_comm_size(couple_communicator, couple_npes, ierror)
37 call test(couple_npes == 5)
38
39 call yac_finit_comm( couple_communicator)
40
41 call yac_fdef_comp(merge('comp_a','comp_b', mype < 3), comp_id)
42
43 call yac_fget_comp_comm(comp_id, comp_communicator)
44 call mpi_comm_size(comp_communicator, comp_npes, ierror)
45 call test(comp_npes == merge(3, 2, mype < 3))
46 call mpi_comm_free(comp_communicator, ierror)
47
48 call yac_fenddef()
49
50 call yac_ffinalize();
51
52 else
53 call mpi_comm_split(mpi_comm_world, 1, 0, couple_communicator, ierror)
54
55 call mpi_comm_size(couple_communicator, couple_npes, ierror)
56 call test(couple_npes == 1)
57 endif
58
59 call mpi_comm_free(couple_communicator, ierror)
60 call mpi_finalize(ierror)
61 call stop_test
62 call exit_tests
63
65
Fortran interface for invoking the end of the definition phase.
Fortran interface for the coupler termination.
Fortran interface for getting back a local MPI communicator.
Fortran interface for the coupler initialisation.
static void merge(char *base_a, size_t num_a, int a_ascending, char *base_b, size_t num_b, int b_ascending, size_t size, int(*compar)(const void *, const void *), char *target)
Definition mergesort.c:56
Definition utest.F90:5
subroutine, public start_test(name)
Definition utest.F90:20
subroutine, public stop_test()
Definition utest.F90:27
subroutine, public exit_tests()
Definition utest.F90:81
program test_init_comm_finalize