-
Notifications
You must be signed in to change notification settings - Fork 2
ENH: Give Error message when no conda env is present #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,26 @@ set -ex | |
|
||
POT3D_HOME=$PWD | ||
TEST="validation" | ||
MPIEXEC=${CONDA_PREFIX}/bin/mpiexec | ||
|
||
cp ${POT3D_HOME}/testsuite/${TEST}/input/* ${POT3D_HOME}/testsuite/${TEST}/run/ | ||
cd ${POT3D_HOME}/testsuite/${TEST}/run | ||
|
||
# Check if conda is active | ||
if [[ -z "$CONDA_PREFIX" ]]; then | ||
echo -e "${RED}Error: No Conda environment is active. Please activate a conda env with MPI installed.${NC}" | ||
exit 1 | ||
fi | ||
|
||
# Try locating mpiexec | ||
if [[ -x "${CONDA_PREFIX}/bin/mpiexec" ]]; then | ||
MPIEXEC="${CONDA_PREFIX}/bin/mpiexec" | ||
elif command -v mpiexec &> /dev/null; then | ||
MPIEXEC=$(command -v mpiexec) | ||
else | ||
echo -e "${RED}Error: mpiexec not found. Please install MPI (OpenMPI or MPICH) via Conda or system package manager.${NC}" | ||
exit 1 | ||
fi | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking for existence of The correct approach probably will be to eventually use cmake build system for us. We've an open issue for this: #19 The current approach isn't the best one though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked pFUnit repository, the way they check the existence of MPI is using cmake's find_package (MPI QUIET COMPONENTS Fortran)
if (MPI_Fortran_FOUND)
message (STATUS "MPI enabled")
if (ENABLE_MPI_F08)
if (NOT MPI_Fortran_HAVE_F08_MODULE)
message (FATAL_ERROR "MPI F08 module requested but not available")
else()
message (STATUS "MPI F08 module enabled")
endif()
endif()
else ()
message (STATUS "MPI not found; building without MPI")
endif() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohh YEs i Didn't see that CMAKE issue Thanks for mentioning it. |
||
# detect MPI implementation | ||
MPI_VERSION=$($MPIEXEC --version 2>&1) | ||
if echo "$MPI_VERSION" | grep -q "Open MPI"; then | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user has global installation of MPI implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition might cause false negative.