The Build directory is removed before compiling preCICE every time. PETSC_DIR and PETSC_ARCH are specified in ~/.bashrc beforehand. I am not sure if this is the reason why FindPETSC locates Pestc. Please find below the new CMakeError.log, which I just repeated the installation procedure with removing the Build directory.
Sorry that I don’t understand what you meant. Which MPI, Intel MPI or OpenMPI, should be used? How to fix the problem? I just tried OpenMPI. It does not work as well… See the configure commands for compiling Petsc with IntelMPI, which is the same as I showed before, and with OpenMPI. When I reinstalled Petsc, the old directory of Petsc was deleted firstly.
The error information for preCICE when OpenMPI is used for Petsc:
– Found MPI_CXX: /home/hd/local/bin/mpicxx (found version “3.0”) ** – Found MPI: TRUE (found version “3.0”) ** CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
** PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH.
** (missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) (Required
** is at least version “3.6”)** Call Stack (most recent call first):
** /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)**
** cmake/modules/FindPETSc.cmake:345 (find_package_handle_standard_args)**
** CMakeLists.txt:148 (find_package)**
– Configuring incomplete, errors occurred! See also “/scratch/hd/sw/precice-develop/build/CMakeFiles/CMakeOutput.log”.
You have to use a single MPI implementation consistently throughout your software stack.
Thus, if you build PETSc with OpenMPI, then you have to build preCICE with OpenMPI too.
This in fact installs PETSc with a custom installation of MPICH (--download-mpich), not Intel MPI.
As far as I understand, you would then have to use the compiler wrapper of the downloaded MPI to compile preCICE (as well as your adapters and solvers if they need to link to preCICE).
Furthermore, sudo may clean your environment variables which can lead to problems. Use the -E flag to preserve the environment. That said, I highly recommend you not to run sudo unless absolutely necessary ( not for configuring and compiling software ).
My recommendation
Please execute the below steps in a single terminal session to preserve the environment.
If everything works smoothly, then you can add them to your ~/.bashrc to make the changes persistent.
This assumes that you have an MPI implementation installed on your system.
1) Setup your environment
export PETSC_DIR=[choose a directory you have write access to]
export PETSC_ARCH=arch-linux2-c-debug
export CXX=[path to your C++ MPI compiler wrapper]
export CC=[path to your C MPI compiler wrapper]
2) Install PETSc
Extract the sources or clone the git repository to the directory PETSC_DIR.
cd $PETSC_DIR
./configure --with-64-bit-indices
make -j `nproc` all test
3) Install preCICE
cd path/to/preCICE
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug ..
make -j `nproc` all
make test
Please keep us informed about problems during the process.
@fsimonis, sorry for the late response. The installation still does not work. I am a bit busy recently, so have no time to summarize the error information. I will come back to you soon.
I followed exactly the steps that you mentioned except for Step 3, where cmake is added with "-DCMAKE_CXX_COMPILER=mpicxx ". The problem is the same as before.
Besides Step 1 is set with
export PETSC_DIR=/scratch/hd/sw/petsc-3.6.4
export PETSC_ARCH=arch-linux2-c-debug
export CXX=/home/hd/local/bin/mpicxx
export CC=/usr/bin/cc
CmakeError.log and CmakeOutput.log can be downloaded from the links below.
@fsimonis, another update. I also tried openmpi. The problem still exists.
export CXX=/usr/bin/mpicxx.openmpi
export CC=/usr/bin/mpiCC.openmpi
cd $PETSC_DIR
./configure --with-64-bit-indices
make -j 4 all test
cd $preCICE-path
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=mpicxx.openmpi -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug …
Besides, I am unsure CC path should be set by cc, mpiCC, or mpicc. I tested all three options.
@HDY Thank you very much!
I had a look at the attached logs and I am really puzzled as the test code used by FindPETSc compiles and links to the expected libraries but fails to run.
Can you try to compile, link and run the example manually?
The exact commands are listed at the very bottom of the CMakeError.log.
There are not the directories: CMakeFiles/cmTC_a93ce.dir, CMakeFiles/cmTC_15772.dir, and CMakeFiles/cmTC_e6fe7.dir.
I created one of the above directories, put the test program in src.cxx in this directory, but have no idea how to create link.txt shown in the CMakeError.log