Fix building without Python

This commit is contained in:
Matthias Hochsteger 2024-07-04 17:26:47 +02:00
parent 000a312dc2
commit d987051f2b
3 changed files with 6 additions and 3 deletions

View File

@ -7,16 +7,16 @@
#include "array.hpp"
#include "ngcore_api.hpp"
#include "pybind11/pytypes.h"
#ifdef NG_PYTHON
#include "pybind11/pytypes.h"
#include "python_ngcore.hpp"
#endif
#define MPI4PY_LIMITED_API 1
#define MPI4PY_LIMITED_API_SKIP_MESSAGE 1
#define MPI4PY_LIMITED_API_SKIP_SESSION 1
#include "mpi4py_pycapi.h" // mpi4py < 4.0.0
#endif
#ifdef MSMPI_VER
int MPI_Comm_create_group(MPI_Comm arg0, MPI_Group arg1, int arg2,

View File

@ -6,7 +6,9 @@
#include "ng_mpi.hpp"
#include "ngstream.hpp"
#ifdef NG_PYTHON
#include "python_ngcore.hpp"
#endif // NG_PYTHON
#include "utils.hpp"
using std::cerr;
@ -94,6 +96,7 @@ void InitMPI(std::optional<std::filesystem::path> mpi_lib_path) {
throw e;
}
} else {
#ifdef NG_PYTHON
// Use mpi4py to init MPI library and get the vendor name
auto mpi4py = py::module::import("mpi4py.MPI");
vendor = mpi4py.attr("get_vendor")()[py::int_(0)].cast<std::string>();
@ -106,6 +109,7 @@ void InitMPI(std::optional<std::filesystem::path> mpi_lib_path) {
mpi_lib =
std::make_unique<SharedLibrary>(mpi4py_lib_file, std::nullopt, true);
#endif // WIN32
#endif // NG_PYTHON
}
std::string ng_lib_name = "";

View File

@ -1,4 +1,3 @@
#include "pybind11/pytypes.h"
#ifdef NG_PYTHON
#include <regex>