简体   繁体   中英

What type for a mpi4py communicator in python?

I am using mpi4py to parallelize my code, I have this kind of function:

def do_something(some_integer: int, comm) -> None:
    ...

Where the comm argument is for an mpi communicator like the following:

from mpi4py import MPI
comm = MPI.COMM_WORLD

I want to use explicit typing for my functions and it is not clear to me what should be the type of the comm argument, ie what should come after comm: ?

Accordingly the MPI documentation that type should be:

mpi4py.MPI.Intracomm

So try it out with

def do_something(some_integer: int, comm: mpi4py.MPI.Intracomm) -> None:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM