Difficulty building dune from scratch with clang/flang
I'm new to this board, so please excuse any newbie mistakes, particularly with respect to cmake. I've only recently started using these tools - not even sure how to properly clean the build area. If it were just makefiles I'd know how....
Anyway: I'm attempting to build dune from source. I pulled the latest version on 11 October 2019. My compiler is AMD AOCC 2.0.0, which is clang+llvm based:
AOCC.LLVM.2.0.0.B191.2019_07_19 clang version 8.0.0 (CLANG: Jenkins AOCC_2_0_0-Build#191) (based on LLVM AOCC.LLVM.2.0.0.B191.2019_07_19)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/administrator/aocc-compiler-2.0.0/bin
I have built SuperLU successfully and am trying to link it in as well. I am using Ubuntu:
administrator@daytonaxq1759-os:~/dune_sources/dune-common$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
My plan is to build dune and then link it to OPM, which I will also build from source.
After puzzling through the manuals, I have created bash script ./build_dune to, well, build dune. I expect what I'm doing isn't in keeping with cmake philosophy...
#!/bin/bash
##https://dune-project.org/sphinx/core-2.6/
source /home/administrator/aocc-compiler-2.0.0/setenv_AOCC.sh
export CMAKE_C_COMPILER=clang
export CMAKE_CXX_COMPILER=clang++
export CMAKE_C_FLAGS="-march=znver2 -mavx -mavx2"
export DUNE_MAX_TEST_CORES=96
export CXX=clang++
export CC=clang
export FC=flang
MPILIBS=/home/administrator/MPILIBS
# BLAS directory ST
BLAS_STEM=/home/administrator/amd-blis
SLU=/home/administrator/SuperLU_MT_3.0
export LD_LIBRARY_PATH=$BLAS_STEM/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$SLU/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MPILIBS/lib:$LD_LIBRARY_PATH
export PATH=$MPILIBS/bin:$PATH
export PATH=$MPILIBS/share:$PATH
export PATH=$MPILIBS/include:$PATH
cd dune_sources
flang --version
mpif90 --showme
./dune-common/bin/dunecontrol all
Running the above script, I get the output below. Since I want to run with mpirun, the mpi subsystem is very important to me; I built it with clang and that's the compiler it "wraps".
The main issue at this point from my newbie perspective is that the build system does not recognize mpif90, see below. This is surprising, because it recognizes mpicc fine, and the Fortran compiler certainly is recognized.
flang --version
AOCC.LLVM.2.0.0.B191.2019_07_19 clang version 8.0.0 (CLANG: Jenkins AOCC_2_0_0-Build#191) (based on LLVM AOCC.LLVM.2.0.0.B191.2019_07_19)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/administrator/aocc-compiler-2.0.0/bin
mpif90 --showme
flang -I/home/administrator/MPILIBS/include -I/home/administrator/MPILIBS/lib -Wl,-rpath -Wl,/home/administrator/MPILIBS/lib -Wl,--enable-new-dtags -L/home/administrator/MPILIBS/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
mpif90 --version
AOCC.LLVM.2.0.0.B191.2019_07_19 clang version 8.0.0 (CLANG: Jenkins AOCC_2_0_0-Build#191) (based on LLVM AOCC.LLVM.2.0.0.B191.2019_07_19)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/administrator/aocc-compiler-2.0.0/bin
mpirun version
mpirun (Open MPI) 3.1.4
Despite this, the build does proceed with errors despite saying it cannot find MPI Fortran.
If I let it go past that it does get to the end, it also can't find SuperLU despite my putting it in the build script, but it seems to build some binaries.
Basically, I'm not sure what to make of the errors, or how to discern errors that don't matter from errors that do... *why is MPI_Fortran_FOUND() not working, for example? *
cmake "/home/administrator/dune_sources/dune-common"
-- The C compiler identification is Clang 8.0.0
-- The CXX compiler identification is Clang 8.0.0
-- Check for working C compiler: /home/administrator/aocc-compiler-2.0.0/bin/clang
-- Check for working C compiler: /home/administrator/aocc-compiler-2.0.0/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/administrator/aocc-compiler-2.0.0/bin/clang++
-- Check for working CXX compiler: /home/administrator/aocc-compiler-2.0.0/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is Flang 99.99.1
-- Check for working Fortran compiler: /home/administrator/aocc-compiler-2.0.0/bin/flang
-- Check for working Fortran compiler: /home/administrator/aocc-compiler-2.0.0/bin/flang -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /home/administrator/aocc-compiler-2.0.0/bin/flang supports Fortran 90
-- Checking whether /home/administrator/aocc-compiler-2.0.0/bin/flang supports Fortran 90 -- yes
-- Performing Test cxx_std_flag_17
-- Performing Test cxx_std_flag_17 - Success
-- Performing Test compiler_supports_cxx17
-- Performing Test compiler_supports_cxx17 - Success
-- Performing Test HAS_ATTRIBUTE_UNUSED
-- Performing Test HAS_ATTRIBUTE_UNUSED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED
-- Performing Test HAS_ATTRIBUTE_DEPRECATED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG - Success
-- Performing Test HAVE_IS_INDEXABLE_SUPPORT
-- Performing Test HAVE_IS_INDEXABLE_SUPPORT - Success
-- Performing Test DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
-- Performing Test DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION - Success
-- Performing Test DUNE_HAVE_CXX_OPTIONAL
-- Performing Test DUNE_HAVE_CXX_OPTIONAL - Success
-- Performing Test DUNE_HAVE_CXX_VARIANT
-- Performing Test DUNE_HAVE_CXX_VARIANT - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Performing Test STDTHREAD_WORKS
-- Performing Test STDTHREAD_WORKS - Success
-- Performing Test DUNE_SUPPORTS_CXX_THROW_IN_CONSTEXPR
-- Performing Test DUNE_SUPPORTS_CXX_THROW_IN_CONSTEXPR - Success
-- Looking for C++ include experimental/type_traits
-- Looking for C++ include experimental/type_traits - found
-- Looking for std::move<std::bool_constant<true>>
-- Looking for std::move<std::bool_constant<true>> - found
-- Looking for std::apply<std::negate<int>,std::tuple<int>>
-- Looking for std::apply<std::negate<int>,std::tuple<int>> - found
-- Looking for std::experimental::make_array<int,int>
-- Looking for std::experimental::make_array<int,int> - found
-- Looking for std::move<std::experimental::detected_t<std::decay_t,int>>
-- Looking for std::move<std::experimental::detected_t<std::decay_t,int>> - found
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Found MPI_C: /home/administrator/MPILIBS/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /home/administrator/MPILIBS/lib/libmpi.so (found version "3.1")
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS)
-- Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1")
-- Verifying Fortran/CXX Compiler Compatibility
-- Verifying Fortran/CXX Compiler Compatibility - Success
-- Could NOT find LATEX (missing: LATEX_COMPILER)
-- Could NOT find LatexMk (missing: LATEXMK_EXECUTABLE)
-- Could NOT find LATEX (missing: LATEX_COMPILER)
CMake Warning at cmake/modules/DuneDoc.cmake:83 (message):
Need latex to create documentation!
Call Stack (most recent call first):
cmake/modules/DuneMacros.cmake:729 (include)
CMakeLists.txt:17 (dune_project)