From d8524d3f43c7ded87ede78a8c327aada0ea1eb73 Mon Sep 17 00:00:00 2001 From: Eric Phipps Date: Thu, 15 Aug 2024 17:15:01 -0600 Subject: [PATCH] Use HAVE_PYTHON_EMBED in goal code --- src/Genten_AlgParams.hpp | 4 ++-- src/Genten_GCP_Goal.hpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Genten_AlgParams.hpp b/src/Genten_AlgParams.hpp index fa5236d29c..530934e023 100644 --- a/src/Genten_AlgParams.hpp +++ b/src/Genten_AlgParams.hpp @@ -48,7 +48,7 @@ #include "Genten_IndxArray.hpp" #include "Genten_Ptree.hpp" -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED #include "pybind11/pytypes.h" #endif @@ -114,7 +114,7 @@ namespace Genten { GCP_Goal_Method::type goal_method; // Way of supplying goal function std::string python_module_name; // Module name for python goal std::string python_object_name; // Object name for python module goal -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED pybind11::object python_object; // Python object for python goal #endif diff --git a/src/Genten_GCP_Goal.hpp b/src/Genten_GCP_Goal.hpp index b940eda090..1fac46e719 100644 --- a/src/Genten_GCP_Goal.hpp +++ b/src/Genten_GCP_Goal.hpp @@ -46,7 +46,7 @@ #include "Genten_Ktensor.hpp" #include "Genten_AlgParams.hpp" -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED #include #endif @@ -76,7 +76,7 @@ namespace Genten { const ttb_real s) const = 0; }; -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED // A goal function implemented as a python object template class __attribute__((visibility("default"))) GCP_PythonObjectGoal : @@ -158,14 +158,14 @@ namespace Genten { if (algParams.goal_method == GCP_Goal_Method::None) goal = nullptr; else if (algParams.goal_method == GCP_Goal_Method::PythonObject) { -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED goal = new GCP_PythonObjectGoal(X, M, algParams.python_object); #else - Genten::error("Python object goal requires python!"); + Genten::error("Python object goal requires embedded python (configure with ENABLE_PYTHON_EMBED=ON)!"); #endif } else if (algParams.goal_method == GCP_Goal_Method::PythonModule) { -#ifdef HAVE_PYTHON +#ifdef HAVE_PYTHON_EMBED try { auto python_module = pybind11::module_::import(algParams.python_module_name.c_str()); @@ -184,7 +184,7 @@ namespace Genten { Genten::error(e.what()); } #else - Genten::error("Python module goal requires python!"); + Genten::error("Python module goal requires embedded python (configure with ENABLE_PYTHON_EMBED=ON)!"); #endif } else