From 372ecce37d1867266471c4d60b6dcf47770f12e9 Mon Sep 17 00:00:00 2001 From: Tyagi Date: Thu, 5 Sep 2024 17:25:45 +1000 Subject: [PATCH] adding mpicc system path of setup.py --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 36c3c4634..389838d37 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,18 @@ import mpi4py conf = mpi4py.get_config() - os.environ["CC"] = conf["mpicc"] + + # Check if "mpicc" is in the mpi4py configuration + if "mpicc" in conf: + os.environ["CC"] = conf["mpicc"] + else: + # Fallback: manually set CC to the path of the mpicc compiler + mpicc_path = os.popen('which mpicc').read().strip() + if mpicc_path: + os.environ["CC"] = mpicc_path + else: + raise KeyError("'mpicc' not found in mpi4py configuration, and 'mpicc' not found in system path. " + "Ensure MPI is installed and 'mpicc' is available.") # PETSc version check - 3.16 or higher from petsc4py import PETSc