Enabling MPI communication within Numba/LLVM JIT-compiled Python code using numba-mpi v1.0

Kacper Derlatka, Maciej Manna, Oleksii Bulenok, David Zwicker, Sylwester Arabas
{"title":"Enabling MPI communication within Numba/LLVM JIT-compiled Python code using numba-mpi v1.0","authors":"Kacper Derlatka, Maciej Manna, Oleksii Bulenok, David Zwicker, Sylwester Arabas","doi":"arxiv-2407.13712","DOIUrl":null,"url":null,"abstract":"The numba-mpi package offers access to the Message Passing Interface (MPI)\nroutines from Python code that uses the Numba just-in-time (JIT) compiler. As a\nresult, high-performance and multi-threaded Python code may utilize MPI\ncommunication facilities without leaving the JIT-compiled code blocks, which is\nnot possible with the mpi4py package, a higher-level Python interface to MPI.\nFor debugging purposes, numba-mpi retains full functionality of the code even\nif the JIT compilation is disabled. The numba-mpi API constitutes a thin\nwrapper around the C API of MPI and is built around Numpy arrays including\nhandling of non-contiguous views over array slices. Project development is\nhosted at GitHub leveraging the mpi4py/setup-mpi workflow enabling continuous\nintegration tests on Linux (MPICH, OpenMPI & Intel MPI), macOS (MPICH &\nOpenMPI) and Windows (MS MPI). The paper covers an overview of the package\nfeatures, architecture and performance. As of v1.0, the following MPI routines\nare exposed and covered by unit tests: size/rank, [i]send/[i]recv,\nwait[all|any], test[all|any], allreduce, bcast, barrier, scatter/[all]gather &\nwtime. The package is implemented in pure Python and depends on numpy, numba\nand mpi4py (the latter used at initialization and as a source of utility\nroutines only). The performance advantage of using numba-mpi compared to mpi4py\nis depicted with a simple example, with entirety of the code included in\nlistings discussed in the text. Application of numba-mpi for handling domain\ndecomposition in numerical solvers for partial differential equations is\npresented using two external packages that depend on numba-mpi: py-pde and\nPyMPDATA-MPI.","PeriodicalId":501256,"journal":{"name":"arXiv - CS - Mathematical Software","volume":"61 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-07-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Mathematical Software","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2407.13712","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

The numba-mpi package offers access to the Message Passing Interface (MPI) routines from Python code that uses the Numba just-in-time (JIT) compiler. As a result, high-performance and multi-threaded Python code may utilize MPI communication facilities without leaving the JIT-compiled code blocks, which is not possible with the mpi4py package, a higher-level Python interface to MPI. For debugging purposes, numba-mpi retains full functionality of the code even if the JIT compilation is disabled. The numba-mpi API constitutes a thin wrapper around the C API of MPI and is built around Numpy arrays including handling of non-contiguous views over array slices. Project development is hosted at GitHub leveraging the mpi4py/setup-mpi workflow enabling continuous integration tests on Linux (MPICH, OpenMPI & Intel MPI), macOS (MPICH & OpenMPI) and Windows (MS MPI). The paper covers an overview of the package features, architecture and performance. As of v1.0, the following MPI routines are exposed and covered by unit tests: size/rank, [i]send/[i]recv, wait[all|any], test[all|any], allreduce, bcast, barrier, scatter/[all]gather & wtime. The package is implemented in pure Python and depends on numpy, numba and mpi4py (the latter used at initialization and as a source of utility routines only). The performance advantage of using numba-mpi compared to mpi4py is depicted with a simple example, with entirety of the code included in listings discussed in the text. Application of numba-mpi for handling domain decomposition in numerical solvers for partial differential equations is presented using two external packages that depend on numba-mpi: py-pde and PyMPDATA-MPI.
使用 numba-mpi v1.0 在 Numba/LLVM JIT 编译的 Python 代码中启用 MPI 通信
numba-mpi 软件包提供了从使用 Numba 即时(JIT)编译器的 Python 代码访问消息传递接口(MPI)例程的功能。因此,高性能和多线程 Python 代码可以在不离开 JIT 编译代码块的情况下使用 MPI 通信设施,而 mpi4py 包(MPI 的高级 Python 接口)则无法做到这一点。为了调试目的,即使禁用 JIT 编译,numba-mpi 也能保留代码的全部功能。numba-mpi API 是 MPI C API 的精简版,围绕 Numpy 数组构建,包括处理数组切片上的非连续视图。项目开发托管在 GitHub 上,利用 mpi4py/setup-mpi 工作流,可在 Linux(MPICH、OpenMPI 和 Intel MPI)、macOS(MPICH 和 OpenMPI)和 Windows(MS MPI)上进行持续集成测试。本文概述了软件包的功能、架构和性能。截至 v1.0,以下 MPI 例程已被公开并包含在单元测试中:size/rank、[i]send/[i]recv、wait[all|any]、test[all|any]、allreduce、bcast、barrier、scatter/[all]gather &wtime。该软件包用纯 Python 实现,依赖于 numpy、numba 和 mpi4py(后者仅用于初始化和作为实用程序的源代码)。与 mpi4py 相比,使用 numba-mpi 在性能上的优势通过一个简单的示例来说明,整个代码包含在文中讨论的列表中。本文使用两个依赖于 numba-mpi 的外部软件包:py-pde 和 PyMPDATA-MPI,介绍了 numba-mpi 在偏微分方程数值求解器中处理域分解的应用。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信