ICON Community Interface 0.4.0
Loading...
Searching...
No Matches
test_mpi.py
Go to the documentation of this file.
1# @authors 11/2023 :: ICON Community Interface <comin@icon-model.org>
2#
3# SPDX-License-Identifier: BSD-3-Clause
4#
5# Please see the file LICENSE in the root of the source tree for this code.
6# Where software is supplied by third parties, it is indicated in the
7# headers of the routines.
8
9from mpi4py import MPI
10import comin
11import sys
12
13rank = comin.parallel_get_host_mpi_rank()
14
15host_comm = MPI.Comm.f2py(comin.parallel_get_host_mpi_comm())
16plugin_comm = MPI.Comm.f2py(comin.parallel_get_plugin_mpi_comm())
17print(f"host_comm: {host_comm.rank}/{host_comm.size}", file=sys.stderr)
18print(f"plugin_comm: {plugin_comm.rank}/{plugin_comm.size}", file=sys.stderr)
19
20assert rank == host_comm.rank
21
22
23@comin.register_callback(comin.EP_SECONDARY_CONSTRUCTOR)
25 host_comm = MPI.Comm.f2py(comin.parallel_get_host_mpi_comm())
26 plugin_comm = MPI.Comm.f2py(comin.parallel_get_plugin_mpi_comm())
27 print(f"host_comm: {host_comm.rank}/{host_comm.size}", file=sys.stderr)
28 print(f"plugin_comm: {plugin_comm.rank}/{plugin_comm.size}", file=sys.stderr)
sec_constructor()
Definition test_mpi.py:24