python - python 中的 mpi4py 通信器是什么类型?

标签 python python-3.x mpi python-typing mpi4py

我正在使用 mpi4py 并行化我的代码,我有这样的功能:

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

其中 comm 参数用于 mpi 通信器,如下所示:

from mpi4py import MPI
comm = MPI.COMM_WORLD

我想对我的函数使用显式类型,但我不清楚 comm 参数的类型应该是什么, comm: 之后应该是什么?

最佳答案

因此MPI documentation该类型应该是:

mpi4py.MPI.Intracomm

所以尝试一下

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

关于python - python 中的 mpi4py 通信器是什么类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66748172/

相关文章:

python - 如何使用类中定义的类?

python - 使用 python 绘制图形并使用 HTML 显示它

Python:如何使用pyautogui lib在屏幕上找到图像?

python - 如何使用 str.join() 而不是 "+="来加入带分隔符的字符串列表?

Python pandas从mysql获取最大值

C语言,利用MPI的Reduce函数,让进程0求所有进程的行列之和

python - 通过 Http 将视频文件从 Unity 上传到 Python

python - Networkx 旅行商问题 (TSP)

cluster-computing - 具有超线程的 MPI 主机文件

parallel-processing - 了解 MPI 发送差异