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.