PrincetonUniversity / SPECFEMPP

SPECFEM++ is a complete re-write of SPECFEM suite of packages (SPECFEM2D, SPECFEM3D, SPECFEM3D_GLOBE) using C++
https://specfem2d-kokkos.readthedocs.io/en/latest/
GNU General Public License v3.0
21 stars 9 forks source link

Add Python bindings - shared memory #147

Open icui opened 2 days ago

icui commented 2 days ago

Create a Python package that allows communication between Python and SPECFEM code. The usage include

Two possible implementations:

  1. Use shared memory. Add a runtime parameter that instructs SPECFEM to use the assigned memory address instead of allocating new CPU memory for the wavefield. This requires minimal change to the current SPECFEM but is less flexible on the Python side.
  2. Expose a function that takes HostView as input, e.g. run_specfem(HostView wavefields). From main(), we call run_specfem() with default initialized host memory whereas from Python code, we call run_specfem() with Python-initialized host memory.
icui commented 2 days ago

It seems that pybind is a more standard approach for kokkos views https://github.com/kokkos/pykokkos-base?tab=readme-ov-file https://www.youtube.com/watch?v=1J3JQ3d3cRc&feature=youtu.be&t=2115

image
icui commented 2 days ago

Also, it's worth thinking how this should be implemented with MPI

icui commented 2 days ago

Package created in PyPI. https://pypi.org/project/specfempp/