From 76ae6b54981bf80730be059a1287fe7fe1fbe0c7 Mon Sep 17 00:00:00 2001 From: Nizar Ben Bouchta Date: Tue, 10 Dec 2024 16:05:06 +0000 Subject: [PATCH] another fix 2 --- keopscore/keopscore/config/__init__.py | 4 ++-- keopscore/keopscore/config/base_config.py | 10 ++++++++-- pykeops/pykeops/common/keops_io/LoadKeOps_cpp.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/keopscore/keopscore/config/__init__.py b/keopscore/keopscore/config/__init__.py index 4276658a..95cd3d3e 100644 --- a/keopscore/keopscore/config/__init__.py +++ b/keopscore/keopscore/config/__init__.py @@ -1,11 +1,11 @@ # Import the configuration classes -from .base_config import ConfigNew +from .base_config import Config from .cuda import CUDAConfig from .openmp import OpenMPConfig from .Platform import DetectPlatform # Instantiate the configurations -config = ConfigNew() +config = Config() platform_detector = DetectPlatform() cuda_config = CUDAConfig() openmp_config = OpenMPConfig() diff --git a/keopscore/keopscore/config/base_config.py b/keopscore/keopscore/config/base_config.py index 5a8bcd8f..19e44a34 100644 --- a/keopscore/keopscore/config/base_config.py +++ b/keopscore/keopscore/config/base_config.py @@ -8,7 +8,7 @@ from keopscore.utils.misc_utils import KeOps_Warning -class ConfigNew: +class Config: """ Base configuration class for the KeOps library. This class contains common attributes and methods shared by other configuration classes. @@ -169,7 +169,13 @@ def set_cxx_compiler(self): else: self.cxx_compiler = None KeOps_Warning( - "No C++ compiler found. You need to either define the CXX environment variable pointing to a valid compiler, or ensure that 'g++' is installed and in your PATH." + """ + The default C++ compiler could not be found on your system. + You need to either define the CXX environment variable or a symlink to the g++ command. + For example if g++-8 is the command you can do: + import os + os.environ['CXX'] = 'g++-8' + """ ) def get_cxx_compiler(self): diff --git a/pykeops/pykeops/common/keops_io/LoadKeOps_cpp.py b/pykeops/pykeops/common/keops_io/LoadKeOps_cpp.py index 166ad60a..7ef66fce 100644 --- a/pykeops/pykeops/common/keops_io/LoadKeOps_cpp.py +++ b/pykeops/pykeops/common/keops_io/LoadKeOps_cpp.py @@ -29,7 +29,7 @@ def init_phase1(self): f = open(srcname, "w") f.write(self.get_pybind11_code()) f.close() - compile_command = f"{keopscore.config.get_cxx_compiler()} {keopscore.config.get_cpp_flags()} {python_includes} {srcname} -o {dllname}" + compile_command = f"{config.get_cxx_compiler()} {config.get_cpp_flags()} {python_includes} {srcname} -o {dllname}" pyKeOps_Message( "Compiling pykeops cpp " + self.params.tag + " module ... ", flush=True,