jedbrown / cmake-modules

CMake modules for some scientific libraries
BSD 2-Clause "Simplified" License
87 stars 54 forks source link

Couldn't find petsc at the SuperMUC HPC system #27

Closed floli closed 6 years ago

floli commented 6 years ago

Hello,

the petsc/3.8 module on the SuperMUC HPC system sets

setenv          PETSC_DIR       /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt
setenv          PETSC_ARCH      arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt
ls $PETSC_DIR
bin  include  lib  share

I am not sure if the environment is misconfigured or rather an edge case that should be fixed in FindPETSC.

Thanks!

jedbrown commented 6 years ago

PETSC_ARCH should be blank (for all --prefix installs, PETSC_ARCH is used for builds in the source tree). Let me know if that doesn't work.

floli commented 6 years ago

Unfortunatly not. I have blanked $PETSC_ARCH, but

> cmake ../..
-- The CXX compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /lrz/sys/compilers/gcc/6.3/bin/c++
-- Check for working CXX compiler: /lrz/sys/compilers/gcc/6.3/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build configuration: Debug
-- Special platform settings: none
-- Found MPI_CXX: /lrz/sys/intel/impi/5.1.3.181/intel64/lib/libmpicxx.so;/lrz/sys/intel/impi/5.1.3.181/intel64/lib/libmpifort.so;/lrz/sys/intel/impi/5.1.3.181/intel64/lib/release_mt/libmpi.so;/lrz/sys/intel/impi/5.1.3.181/intel64/lib/libmpigi.a;/usr/lib64/libdl.so;/usr/lib64/librt.so;/usr/lib64/libpthread.so
-- petsc_lib_dir /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/lib
-- Recognized PETSc install with single library for all packages
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Failed
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes
-- Performing Test MULTIPASS_TEST_2_petsc_works_allincludes - Failed
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries
-- Performing Test MULTIPASS_TEST_3_petsc_works_alllibraries - Failed
-- Performing Test MULTIPASS_TEST_4_petsc_works_all
-- Performing Test MULTIPASS_TEST_4_petsc_works_all - Failed
-- PETSc could not be used, maybe the install is broken.
CMake Error at /lrz/mnt/sys.x86_64/tools/cmake/3.6.2/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  PETSc could not be found.  Be sure to set PETSC_DIR and PETSC_ARCH.
  (missing: PETSC_EXECUTABLE_RUNS) (found suitable version "3.8.2", minimum
  required is "3.6")
Call Stack (most recent call first):
  /lrz/mnt/sys.x86_64/tools/cmake/3.6.2/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  tools/cmake-modules/FindPETSc.cmake:331 (find_package_handle_standard_args)
  CMakeLists.txt:41 (find_package)

-- Configuring incomplete, errors occurred!
See also "/gpfs/work/pr62cu/di29veb3/shared_exafsa/software/precice/build/cmake-release/CMakeFiles/CMakeOutput.log".
See also "/gpfs/work/pr62cu/di29veb3/shared_exafsa/software/precice/build/cmake-release/CMakeFiles/CMakeError.log".

I have also uploaded the two log files:

CMakeError.log CMakeOutput.log

The CMakeLists is at https://github.com/precice/precice/blob/develop/CMakeLists.txt

Best Thanks!

jedbrown commented 6 years ago

You need an MPI compiler.

/lrz/sys/compilers/gcc/6.3/bin/c++    -I/lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include  -Wall -DMULTIPASS_TEST_1_petsc_works_minimal   -o CMakeFiles/cmTC_f346a.dir/src.cxx.o -c /gpfs/work/pr62cu/di29veb3/shared_exafsa/software/precice/build/cmake-release/CMakeFiles/CMakeTmp/src.cxx
In file included from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscis.h:7:0,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscvec.h:9,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscmat.h:6,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscpc.h:6,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscksp.h:6,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscsnes.h:6,
                 from /lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscts.h:7,
                 from /gpfs/work/pr62cu/di29veb3/shared_exafsa/software/precice/build/cmake-release/CMakeFiles/CMakeTmp/src.cxx:3:
/lrz/sys/libraries/petsc/3.8.2/Medium_Node/arch-linux-3-c-3.8.2-Medium_Node-real_mpi.intel_5.1_opt/include/petscsys.h:130:17: fatal error: mpi.h: No such file or directory
 #include <mpi.h>
                 ^

One way to do this is

CC=/path/to/mpicc CXX=/path/to/mpicxx cmake ..

Alternatively, you can use FindMPI which tries to find the right flags to use MPI, but is more error-prone in my experience and there is no consensus among CMake developers whether to use it or the compiler wrappers.

floli commented 6 years ago

I actually use FindMPI:

find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
set(COMPILE_FLAGS  ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS})

Thought that it sets the flags correctly.

However CC=mpicc CXX=mpicxx cmake ../.. did the trick, even without unsetting PETSC_ARCH.

If you say, that this is a FindMPI problem, the issue can be closed.

jedbrown commented 6 years ago

I'm not going to make FindPETSc depend on FindMPI because (a) MPI is not needed in serial and (b) FindMPI is quite fragile, complicated, and often not used in favor of CC=mpicc.