LLNL / libROM

Model reduction library with an emphasis on large scale parallelism and linear subspace methods
https://www.librom.net
Other
201 stars 36 forks source link

Compiling LibROM #169

Closed JacobLotz closed 1 year ago

JacobLotz commented 1 year ago

Hi All,

I am trying to compile libROM from source but I am not succesfull up to now. I work on Ubuntu 22.04.

1) When using ./scripts/compile.sh cmake is unable to find Blas and Lapack and the script fails:

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find BLAS (missing: BLAS_LIBRARIES) (Required is at least version
  "3.4.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindBLAS.cmake:1337 (find_package_handle_standard_args)
  CMakeLists.txt:102 (find_package)

EDIT: This is problably obvious as it is meant for LLNL machines only.

2) When I build in a folder (FI build2) with cmake .. and make it can find Lapack and Blas but the build fails with:

/usr/bin/ld: CMakeFiles/combine_samples.dir/examples/misc/combine_samples.cpp.o: in function `MPI::Intracomm::Intracomm()':
combine_samples.cpp:(.text._ZN3MPI9IntracommC2Ev[_ZN3MPI9IntracommC5Ev]+0x18): undefined reference to `MPI::Comm::Comm()'
/usr/bin/ld: CMakeFiles/combine_samples.dir/examples/misc/combine_samples.cpp.o: in function `MPI::Intracomm::Intracomm(ompi_communicator_t*)':
combine_samples.cpp:(.text._ZN3MPI9IntracommC2EP19ompi_communicator_t[_ZN3MPI9IntracommC5EP19ompi_communicator_t]+0x2c): undefined reference to `MPI::Comm::Comm()'
/usr/bin/ld: CMakeFiles/combine_samples.dir/examples/misc/combine_samples.cpp.o: in function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
combine_samples.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[_ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb]+0x2a): undefined reference to `ompi_mpi_cxx_op_intercept'
/usr/bin/ld: CMakeFiles/combine_samples.
dir/examples/misc/combine_samples.cpp.o:(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
/usr/bin/ld: CMakeFiles/combine_samples.dir/examples/misc/combine_samples.cpp.o:(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
collect2: error: ld returned 1 exit status

make[2]: *** [CMakeFiles/combine_samples.dir/build.make:119: examples/misc/combine_samples] Error 1
make[1]: *** [CMakeFiles/Makefile2:124: CMakeFiles/combine_samples.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I have attached the full logs: log-cmake.txt log-make.txt

I have liblapack-dev libblas-dev libscalapack-mpi-dev installed. Am I doing something wrong here?

EDIT: It fails when compiling combine_samples. We found it that it is somehow compiling it with a serial compiler usr/bin/c++ instead of a parallel one usr/bin/mpic++ therefore it cannot deal with the MPI stuff. If we update the commands given by make VERBOSE=1 combine_samples to the parallel compiler it does not give these errors. Maybe something should be updated in the CMake files?

Kind regards,

Jacob Lotz

JacobLotz commented 1 year ago

@dylan-copeland I am problably just very impatient. But I might just ask you here well. I have not been able to figure this out yet and is there someone I could ask for help specifically?

EDIT: With the risk of stating the obvious. It was actually simple to compile in the end. First run ./scripts/setup.sh We then compiled it with running the following in libROM/build:

cmake .. \
-DCMAKE_CXX_COMPILER=/usr/bin/mpicxx \
-DUSE_MFEM=On \
-DHYPRE=/path-to-libROM/libROM/dependencies/hypre/src/lib/libHYPRE.a \
-DHYPRE_INCLUDES=/path-to-libROM/libROM/dependencies/hypre/src/hypre/include \
-DMETIS=/path-to-libROM/libROM/libROM/dependencies/parmetis-4.0.3/build/Linux-x86_64/libmetis/libmetis.a \
-DMFEM=/path-to-libROM/libROM/libROM/dependencies/mfem/libmfem.so  \
-DMFEM_INCLUDES=/path-to-libROM/libROM/libROM/dependencies/mfem    \

make -j 4
dylan-copeland commented 1 year ago

@JacobLotz sorry for the inconvenience, but I am glad to hear you got it to build. On my MacBook, ./scripts/compile.sh works automatically, so maybe there is an issue on Ubuntu. Perhaps README.md should mention ./scripts/setup.sh. Our build system expert is @pranav-vempati, so maybe he can make some improvements for Ubuntu. By the way, please note that ./scripts/compile.sh -m builds with MFEM.

JacobLotz commented 1 year ago

@dylan-copeland no problem at all! Thank you again for your help!