From 1f2e526c2f6d53e1d81d944e039d4ba3ffa51334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sat, 11 Jan 2020 17:50:23 +0000 Subject: [PATCH 1/2] [Sundials] Build with OpenBLAS support --- S/Sundials/build_tarballs.jl | 39 ++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/S/Sundials/build_tarballs.jl b/S/Sundials/build_tarballs.jl index 67d3104132e..533f303997d 100644 --- a/S/Sundials/build_tarballs.jl +++ b/S/Sundials/build_tarballs.jl @@ -18,14 +18,19 @@ patch -p0 < $WORKSPACE/srcdir/patches/Sundials_windows.patch CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}") CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=Release -DEXAMPLES_ENABLE_C=OFF) CMAKE_FLAGS+=(-DKLU_ENABLE=ON -DKLU_INCLUDE_DIR="$prefix/include" -DKLU_LIBRARY_DIR="$libdir") -CMAKE_FLAGS+=(-DBLAS_ENABLE=OFF -DLAPACK_ENABLE=OFF) +CMAKE_FLAGS+=(-DBLAS_ENABLE=ON -DLAPACK_ENABLE=ON) -#if [[ ${nbits} == 64 ]] && [[ ${target} != aarch64* ]]; then -# patch -p0 < $WORKSPACE/srcdir/patches/Sundials_ilp64.patch -# CMAKE_FLAGS+=(-DBLAS_LIBRARIES="${libdir}/libopenblas64_.${dlext}" -DLAPACK_LIBRARIES="${libdir}/libopenblas64_.${dlext}") -#else -# CMAKE_FLAGS+=(-DBLAS_LIBRARIES="${libdir}/libopenblas.${dlext}" -DLAPACK_LIBRARIES="${libdir}/libopenblas.${dlext}") -#fi +if [[ ${nbits} == 64 ]] && [[ ${target} != aarch64* ]]; then + patch -p0 < $WORKSPACE/srcdir/patches/Sundials_ilp64.patch + CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas64_" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas64_") +else + CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas") +fi + +if [[ ${target} != *darwin* ]]; then + # Needed to find libgfortran for OpenBLAS. + export CFLAGS="-Wl,-rpath-link,/opt/${target}/${target}/lib -Wl,-rpath-link,/opt/${target}/${target}/lib64" +fi mkdir build cd build @@ -43,24 +48,24 @@ fi platforms = supported_platforms() products = [ - LibraryProduct("libsundials_sunlinsolspfgmr", :libsundials_sunlinsolspfgmr), - LibraryProduct("libsundials_ida", :libsundials_ida), + LibraryProduct("libsundials_arkode", :libsundials_arkode), LibraryProduct("libsundials_cvode", :libsundials_cvode), LibraryProduct("libsundials_cvodes", :libsundials_cvodes), - LibraryProduct("libsundials_sunmatrixdense", :libsundials_sunmatrixdense), - LibraryProduct("libsundials_sunlinsolspbcgs", :libsundials_sunlinsolspbcgs), + LibraryProduct("libsundials_ida", :libsundials_ida), LibraryProduct("libsundials_idas", :libsundials_idas), + LibraryProduct("libsundials_kinsol", :libsundials_kinsol), LibraryProduct("libsundials_nvecserial", :libsundials_nvecserial), + LibraryProduct("libsundials_sunlinsolband", :libsundials_sunlinsolband), LibraryProduct("libsundials_sunlinsoldense", :libsundials_sunlinsoldense), - LibraryProduct("libsundials_sunlinsolspgmr", :libsundials_sunlinsolspgmr), + LibraryProduct("libsundials_sunlinsolklu", :libsundials_sunlinsolklu), LibraryProduct("libsundials_sunlinsolpcg", :libsundials_sunlinsolpcg), + LibraryProduct("libsundials_sunlinsolspbcgs", :libsundials_sunlinsolspbcgs), + LibraryProduct("libsundials_sunlinsolspfgmr", :libsundials_sunlinsolspfgmr), + LibraryProduct("libsundials_sunlinsolspgmr", :libsundials_sunlinsolspgmr), LibraryProduct("libsundials_sunlinsolsptfqmr", :libsundials_sunlinsolsptfqmr), - LibraryProduct("libsundials_sunlinsolklu", :libsundials_sunlinsolklu), - LibraryProduct("libsundials_sunmatrixsparse", :libsundials_sunmatrixsparse), - LibraryProduct("libsundials_sunlinsolband", :libsundials_sunlinsolband), LibraryProduct("libsundials_sunmatrixband", :libsundials_sunmatrixband), - LibraryProduct("libsundials_kinsol", :libsundials_kinsol), - LibraryProduct("libsundials_arkode", :libsundials_arkode), + LibraryProduct("libsundials_sunmatrixdense", :libsundials_sunmatrixdense), + LibraryProduct("libsundials_sunmatrixsparse", :libsundials_sunmatrixsparse), ] dependencies = [ From 6580497342a48123dcbf6e0fcaf5ae686ec4d3fa Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Wed, 5 Feb 2020 03:48:59 -0500 Subject: [PATCH 2/2] Update build_tarballs.jl --- S/Sundials/build_tarballs.jl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/S/Sundials/build_tarballs.jl b/S/Sundials/build_tarballs.jl index 533f303997d..b1c3fd3823e 100644 --- a/S/Sundials/build_tarballs.jl +++ b/S/Sundials/build_tarballs.jl @@ -18,14 +18,15 @@ patch -p0 < $WORKSPACE/srcdir/patches/Sundials_windows.patch CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}") CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=Release -DEXAMPLES_ENABLE_C=OFF) CMAKE_FLAGS+=(-DKLU_ENABLE=ON -DKLU_INCLUDE_DIR="$prefix/include" -DKLU_LIBRARY_DIR="$libdir") -CMAKE_FLAGS+=(-DBLAS_ENABLE=ON -DLAPACK_ENABLE=ON) -if [[ ${nbits} == 64 ]] && [[ ${target} != aarch64* ]]; then - patch -p0 < $WORKSPACE/srcdir/patches/Sundials_ilp64.patch - CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas64_" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas64_") -else - CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas") -fi +### Disable BLAS and LAPACK because sundials 3.1 cannot use 64-bit ints with these libraries +#CMAKE_FLAGS+=(-DBLAS_ENABLE=ON -DLAPACK_ENABLE=ON) +#if [[ ${nbits} == 64 ]] && [[ ${target} != aarch64* ]]; then +# patch -p0 < $WORKSPACE/srcdir/patches/Sundials_ilp64.patch +# CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas64_" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas64_") +#else +# CMAKE_FLAGS+=(-DBLAS_LIBRARIES="-L${libdir} -lopenblas" -DLAPACK_LIBRARIES="-L${libdir} -lopenblas") +#fi if [[ ${target} != *darwin* ]]; then # Needed to find libgfortran for OpenBLAS.