aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/WarpX.py
diff options
context:
space:
mode:
authorGravatar KZhu-ME <86268612+KZhu-ME@users.noreply.github.com> 2021-07-09 20:13:56 -0700
committerGravatar GitHub <noreply@github.com> 2021-07-09 20:13:56 -0700
commitf462adc324cf466b60d62bc8c06c035221b75861 (patch)
tree3b100b97e40559ee9d809698e7a348b1c033220c /Python/pywarpx/WarpX.py
parentb28004a648e5b729f8ef52c89d8df7a9423e368c (diff)
downloadWarpX-f462adc324cf466b60d62bc8c06c035221b75861.tar.gz
WarpX-f462adc324cf466b60d62bc8c06c035221b75861.tar.zst
WarpX-f462adc324cf466b60d62bc8c06c035221b75861.zip
Feature pass MPI comm from Python script to AMReX during initialization (#2034)
* Added functionality to pass mpi comm from python script to amrex during initialization * Fixed missing _ in MPI._sizeof() * Added functions to get the current processor's rank and total number of processors * Renamed MPI_Comm to _MPI_Comm_type and defined _MPI_Comm_type in except statement * Updated comment to explain why mpi4py needs to be imported before loading libwarpx * Removed ifdef flags that prevent amrex_init_with_inited_mpi from being declared when MPI is off * Changed amrex_init_with_inited_mpi to be declared even when not using mpi, but will be defined to be functionally the same as amrex_init * Defined MPI = None to signify whether MPI is used, to add another check when initializing amrex * Changed ifdef blocks in WarpXWrappers.cpp/h to fix compile errors. Added ifdef block to conditionally declare amrex_init_with_inited_mpi in WarpXWrappers.h to prevent compile error when not using MPI. Removed ifdef block to declare/define same function in WarpXWrappers.cpp since function needs to be declared even when MPI is not used, but will never be called in that case. * Changed BL_USE_MPI to AMREX_USE_MPI and removed incorrect MPI=None statement * Changed BL_USE_MPI to AMREX_USE_MPI * Added test to verify correct passing of MPI communicator to amrex * Added ability to pass mpi_comm to sim.step * Change test to check for differeing outputs when passed different inputs * Removed obsolete comments refactored program to use more shared code * Refactored comments * Updated description to match test * Removed unecessary imports and updated comments
Diffstat (limited to 'Python/pywarpx/WarpX.py')
-rw-r--r--Python/pywarpx/WarpX.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pywarpx/WarpX.py b/Python/pywarpx/WarpX.py
index dc09ba241..73106cf62 100644
--- a/Python/pywarpx/WarpX.py
+++ b/Python/pywarpx/WarpX.py
@@ -68,10 +68,10 @@ class WarpX(Bucket):
return argv
- def init(self):
+ def init(self, mpi_comm=None):
from . import wx
argv = ['warpx'] + self.create_argv_list()
- wx.initialize(argv)
+ wx.initialize(argv, mpi_comm=mpi_comm)
def evolve(self, nsteps=-1):
from . import wx