GEOS-DEV / GEOS

GEOS Simulation Framework
GNU Lesser General Public License v2.1
211 stars 85 forks source link

Cannot build `thirdPartyLibs` as blt cannot find the MPI #3375

Open lokitkhemka opened 2 weeks ago

lokitkhemka commented 2 weeks ago

CMake cannot seem to find MPI Package:

CMake Error in /home/loki/Desktop/GEOS/thirdPartyLibs/build-host-config-debug/CMakeFiles/CMakeScratch/TryCompile-IqJlmE/CMakeLists.txt:
  Imported target "MPI::MPI_C" includes non-existent path

    "/home/loki/Desktop/GEOS/thirdPartyLibs/I_MPI_SUBSTITUTE_INSTALLDIR/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

But, I have MPI installed through Intel OneAPI package and locations of the compilers are as follows:

set(ENABLE_MPI ON CACHE PATH "")
set(MPI_C_COMPILER "/opt/intel/oneapi/mpi/latest/bin/mpicc" CACHE PATH "")
set(MPI_CXX_COMPILER "/opt/intel/oneapi/mpi/latest/bin/mpicxx" CACHE PATH "")
set(MPIEXEC "/opt/intel/oneapi/mpi/latest/bin/mpirun" CACHE PATH "") 

Do I need to add any more environment variables?

set(MPI_C_INCLUDE_PATH "/opt/intel/oneapi/mpi/latest/include/" CACHE PATH "")

I tried adding this, but it didn't work. Any help you can provide will be greatly appreciated. Thank you so much. I am on Pop OS 22.04.

lokitkhemka commented 1 week ago

I was able to build the third-Party Libraries. However, the config-build.py script cannot find the installation folder. The host-config file is as follows:

set( CONFIG_NAME "quick-start" ) 

set(GEOS_TPL_DIR "~/Desktop/GEOS/thirdPartyLibs/" CACHE PATH "")

# Set compilers path
set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE PATH "")   # This is typically something like /usr/bin/gcc ... or clang
set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE PATH "") # This is typically something like /usr/bin/g++ ... or clang++
set(ENABLE_FORTRAN OFF CACHE BOOL "" FORCE)

# Set paths to mpi
set(ENABLE_MPI ON CACHE PATH "")

set(MPI_C_COMPILER "/usr/bin/mpicc" CACHE PATH "")    # This is typically something like /usr/bin/mpicc
set(MPI_CXX_COMPILER "/usr/bin/mpicxx" CACHE PATH "") # This is typically something like /usr/bin/mpicxx
set(MPIEXEC "/usr/bin/mpirun" CACHE PATH "")          # This is typically something like /usr/bin/mpirun
set(MPI_Fortran_COMPILER "/usr/bin/mpifort" CACHE PATH "")

# Set paths to blas and lapack
set( BLAS_LIBRARIES "/usr/lib/x86_64-linux-gnu/blas/libblas.so" CACHE PATH "" FORCE )     # This is typically something like /usr/lib64/libblas.so 
set( LAPACK_LIBRARIES "/usr/lib/x86_64-linux-gnu/lapack/liblapack.so" CACHE PATH "" FORCE ) # This is typically something like /usr/lib64/liblapack.so

# Cuda and openMP
set( ENABLE_CUDA ON CACHE PATH "" FORCE )
set( ENABLE_OPENMP OFF CACHE PATH "" FORCE )

# TPLs
set( ENABLE_TRILINOS ON CACHE PATH "" FORCE )
set( ENABLE_CALIPER OFF CACHE PATH "" FORCE )
set( ENABLE_DOXYGEN OFF CACHE BOOL "" FORCE)
set( ENABLE_MATHPRESSO OFF CACHE BOOL "" FORCE )

if(NOT ( EXISTS "${GEOS_TPL_DIR}" AND IS_DIRECTORY "${GEOS_TPL_DIR}" ) )
   set(GEOS_TPL_DIR "${CMAKE_SOURCE_DIR}/../../thirdPartyLibs/install-${CONFIG_NAME}-release" CACHE PATH "" FORCE )
endif()

The thirdPartyLibs folder location is ~/Desktop/GEOS/thirdPartyLibs/ and the install folder location is ~/Desktop/GEOS/thirdPartyLibs/install-host-config-release. But setting both values result in the same error:

CMake Error at cmake/thirdparty/SetupGeosxThirdParty.cmake:118 (message):
  GEOSX requires Conduit, either :

    - Verify that you provided a valid TPL installation directory (GEOS_TPL_DIR = "/home/loki/Desktop/GEOS/thirdPartyLibs"),
    - Or set CONDUIT_DIR to the Conduit installation directory (CONDUIT_DIR = "").

Call Stack (most recent call first):
  cmake/thirdparty/SetupGeosxThirdParty.cmake:210 (mandatory_tpl_doesnt_exist)
  cmake/CMakeBasics.cmake:49 (include)
  CMakeLists.txt:70 (include)

Any help you can provide is appreciated. Thank you.

lokitkhemka commented 1 week ago

After much trial and error, I was able to modify the host-config file to add the following lines:

set(GEOS_TPL_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/" CACHE PATH "")
set(CONDUIT_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/conduit" CACHE PATH "")
set(PUGIXML_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/pugixml" CACHE PATH "")
set(RAJA_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/raja" CACHE PATH "")
set(FMT_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/fmt" CACHE PATH "")
set(CHAI_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/chai" CACHE PATH "")
set(UMPIRE_DIR "~/Desktop/GEOS/thirdPartyLibes/install-host-config-release/chai/lib/cmake/umpire" CACHE PATH "")
set(umpire_DIR "~/Desktop/GEOS/thirdPartyLibes/install-host-config-release/chai/lib/cmake/umpire" CACHE PATH "")

However, now config-build.py cannot find umpire.

rrsettgast commented 1 week ago

Hello @lokitkhemka , You should not be setting any of those directories. They are set once the proper GEOS_TPL_DIR is set. In your case, it looks like you have omitted the install directory under your TPL directory. Specifically:

set(GEOS_TPL_DIR "~/Desktop/GEOS/thirdPartyLibs/" CACHE PATH "")

should be something like:

set(GEOS_TPL_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release" CACHE PATH "")

Do that and remove these from your hostconfig:

set(GEOS_TPL_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/" CACHE PATH "")
set(CONDUIT_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/conduit" CACHE PATH "")
set(PUGIXML_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/pugixml" CACHE PATH "")
set(RAJA_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/raja" CACHE PATH "")
set(FMT_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/fmt" CACHE PATH "")
set(CHAI_DIR "~/Desktop/GEOS/thirdPartyLibs/install-host-config-release/chai" CACHE PATH "")
set(UMPIRE_DIR "~/Desktop/GEOS/thirdPartyLibes/install-host-config-release/chai/lib/cmake/umpire" CACHE PATH "")
set(umpire_DIR "~/Desktop/GEOS/thirdPartyLibes/install-host-config-release/chai/lib/cmake/umpire" CACHE PATH "")

and you should have better luck.

lokitkhemka commented 1 week ago

As you said, I have set GEOS_TPL_DIR in the host-config file of thirdPartyLibs and removed the above lines from host-config file and I still get the error

CMake Error at cmake/thirdparty/SetupGeosxThirdParty.cmake:118 (message):
  GEOSX requires Conduit, either :

    - Verify that you provided a valid TPL installation directory (GEOS_TPL_DIR = ""),
    - Or set CONDUIT_DIR to the Conduit installation directory (CONDUIT_DIR = "").

Call Stack (most recent call first):
  cmake/thirdparty/SetupGeosxThirdParty.cmake:210 (mandatory_tpl_doesnt_exist)
  cmake/CMakeBasics.cmake:49 (include)
  CMakeLists.txt:70 (include)

If I am setting GEOS_TPL_DIR in the host-config for the main project, I get the following error:

CMake Error at cmake/thirdparty/SetupGeosxThirdParty.cmake:118 (message):
  GEOSX requires Conduit, either :

    - Verify that you provided a valid TPL installation directory (GEOS_TPL_DIR = "/home/loki/Desktop/GEOS/thirdPartyLibs/install-host-config-release"),
    - Or set CONDUIT_DIR to the Conduit installation directory (CONDUIT_DIR = "").

Call Stack (most recent call first):
  cmake/thirdparty/SetupGeosxThirdParty.cmake:210 (mandatory_tpl_doesnt_exist)
  cmake/CMakeBasics.cmake:49 (include)
  CMakeLists.txt:70 (include)

Thank you. Basically, CMake is not able to find third party libs from the install location. Also, it seems Umpire is not getting installed properly because I am able to point to other libraries, but not Umpire.

rrsettgast commented 1 week ago

Hello @lokitkhemka , Not sure I am understanding correctly...but you don't need to set the GEOS_TPL_DIR in when building the TPL's. They will build wherever you cloned them. If you would like to specify an input directory you do so on the command line of the config-build.py execution. You should only have a single hostconfig file in the main repo. You should refer to this hostconfig when building the TPL's.

rrsettgast commented 1 week ago

@drmichaeltcvx Have you built with intel?

lokitkhemka commented 1 week ago

When I set GEO_TPL_DIR, in the host-config of the GEOS project, it still doesn't find the TPL directory.

lokitkhemka commented 1 week ago

Could it be that I am building TPLs with Release and GEOS with Debug that is causing the issue?

EDIT: I checked by building a debug build of TPLs and then trying, but it's not working.

drmichaeltcvx commented 1 week ago

@drmichaeltcvx Have you built with intel?

When I started experimenting with different compilers (2023), I also tried Intel toolchain. At that time both Classic and 1-api could not build some TPL packages and I gave up.

I haven't tried the latest 1-api Intel compilers though which are LLVM based and thus may be able to compile everything.

Note that we can compile with GCC, say, and still use the IntelMPI stack. @lokitkhemka is actually invoking the IntelMPI wrappers that use GNU host compilers (mpiccand mpicx)