Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sundials 3.1] Build with OpenBLAS support #378

Merged
merged 2 commits into from
Feb 9, 2020

Conversation

giordano
Copy link
Member

This should make it possible to build with support for OpenBLAS, but it's not clear to me if it's still desired. CC: @ViralBShah.

Note: it's a draft because this requires JuliaPackaging/BinaryBuilder.jl#604.

@ViralBShah
Copy link
Member

If it works, we should merge it.

Going forward we want to put the efforts into sundials 5.1, which seems to significantly address these sorts of issues.

@ViralBShah
Copy link
Member

Note that the LAPACK will not work irrespective because sundials 3 does not support 64-bit ints for lapack, and the cmake will disable the lapack.

@giordano
Copy link
Member Author

If it works, we should merge it.

I tested locally for a couple of platforms, with JuliaPackaging/BinaryBuilder.jl#604 the dependencies should be setup correctly. However right now the agents of the pipelines are all offline, so we don't the have the CI service.

@ViralBShah
Copy link
Member

Should we move this to Sundials@3 to make way for Sundials@5 ?

@ViralBShah
Copy link
Member

Should we proceed with this one?

@giordano
Copy link
Member Author

I need to finish JuliaPackaging/BinaryBuilder.jl#604 first.

@jd-lara
Copy link
Contributor

jd-lara commented Jan 16, 2020

I suggest using https://github.com/LLNL/sundials/releases in this PR. As per the changes in the release, issues with LAPACK and KLU are resolved.

@giordano giordano closed this Jan 19, 2020
@giordano giordano reopened this Jan 19, 2020
@ViralBShah
Copy link
Member

@jd-lara Note that it is using the correct github repo, but we are building only release v3.1, which is the current compatible version for the current Sundials.jl.

@giordano giordano marked this pull request as ready for review January 19, 2020 04:33
@giordano
Copy link
Member Author

@ViralBShah After we fixed the issue in BinaryBuilder with setting up the correct dependencies, now OpenBlas should always be found in these builds. However, is it normal that none of the libraries is directly linked to libopenblas? E.g., libraries for x86_64-linux-gnu:

sandbox:${WORKSPACE} # for file in libsundials_*.so; do echo $file; ${target}-objdump -p $file|grep NEEDED; done
libsundials_arkode.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_cvode.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_cvodes.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_ida.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_idas.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_kinsol.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_nvecserial.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolband.so
  NEEDED               libsundials_sunmatrixband.so.1
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsoldense.so
  NEEDED               libsundials_sunmatrixdense.so.1
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolklu.so
  NEEDED               libsundials_sunmatrixsparse.so.1
  NEEDED               libklu.so.1
  NEEDED               libamd.so.2
  NEEDED               libcolamd.so.2
  NEEDED               libbtf.so.1
  NEEDED               libsuitesparseconfig.so.5
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolpcg.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolspbcgs.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolspfgmr.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolspgmr.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunlinsolsptfqmr.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunmatrixband.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunmatrixdense.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
libsundials_sunmatrixsparse.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6

For macOS:

sandbox:${WORKSPACE} # for file in $(realpath libsundials_*.dylib|uniq); dootool -L $file; done
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_arkode.2.1.1.dylib:
        @rpath/libsundials_arkode.2.dylib (compatibility version 2.0.0, current version 2.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_cvode.3.1.1.dylib:
        @rpath/libsundials_cvode.3.dylib (compatibility version 3.0.0, current version 3.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_cvodes.3.1.1.dylib:
        @rpath/libsundials_cvodes.3.dylib (compatibility version 3.0.0, current version 3.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_ida.3.1.1.dylib:
        @rpath/libsundials_ida.3.dylib (compatibility version 3.0.0, current version 3.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_idas.2.1.0.dylib:
        @rpath/libsundials_idas.2.dylib (compatibility version 2.0.0, current version 2.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_kinsol.3.1.1.dylib:
        @rpath/libsundials_kinsol.3.dylib (compatibility version 3.0.0, current version 3.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_nvecserial.3.1.1.dylib:
        @rpath/libsundials_nvecserial.3.dylib (compatibility version 3.0.0, current version 3.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolband.1.1.1.dylib:
        @rpath/libsundials_sunlinsolband.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        @rpath/libsundials_sunmatrixband.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsoldense.1.1.1.dylib:
        @rpath/libsundials_sunlinsoldense.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        @rpath/libsundials_sunmatrixdense.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolklu.1.1.1.dylib:
        @rpath/libsundials_sunlinsolklu.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        @rpath/libsundials_sunmatrixsparse.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        @rpath/libklu.1.3.8.dylib (compatibility version 1.0.0, current version 1.3.8)
        @rpath/libamd.2.4.6.dylib (compatibility version 2.0.0, current version 2.4.6)
        @rpath/libcolamd.2.9.6.dylib (compatibility version 2.0.0, current version 2.9.6)
        @rpath/libbtf.1.2.6.dylib (compatibility version 1.0.0, current version 1.2.6)
        @rpath/libsuitesparseconfig.5.4.0.dylib (compatibility version 5.0.0, current version 5.4.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolpcg.1.1.1.dylib:
        @rpath/libsundials_sunlinsolpcg.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolspbcgs.1.1.1.dylib:
        @rpath/libsundials_sunlinsolspbcgs.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolspfgmr.1.1.1.dylib:
        @rpath/libsundials_sunlinsolspfgmr.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolspgmr.1.1.1.dylib:
        @rpath/libsundials_sunlinsolspgmr.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunlinsolsptfqmr.1.1.1.dylib:
        @rpath/libsundials_sunlinsolsptfqmr.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunmatrixband.1.1.1.dylib:
        @rpath/libsundials_sunmatrixband.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunmatrixdense.1.1.1.dylib:
        @rpath/libsundials_sunmatrixdense.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/workspace/Sundials.v3.1.1.x86_64-apple-darwin14/lib/libsundials_sunmatrixsparse.1.1.1.dylib:
        @rpath/libsundials_sunmatrixsparse.1.dylib (compatibility version 1.0.0, current version 1.1.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

@ViralBShah
Copy link
Member

ViralBShah commented Jan 19, 2020

That is a bit odd. I wonder if this is only meaningful when lapack is enabled. @jd-lara ? @ChrisRackauckas?

@ChrisRackauckas
Copy link

The makefile disables the linking if the BLAS is not a 32-bit BLAS. This is supposedly fixed in Sundials 5.1

@ViralBShah
Copy link
Member

ViralBShah commented Jan 20, 2020

I think we patch it, so it shouldn't be an issue (in theory). Anyways, we have sundials 3.1 as before - since BLAS is not getting linked, we have not much to gain by merging this.

Best to update this PR for 5.1.

@jd-lara
Copy link
Contributor

jd-lara commented Jan 20, 2020

I will make an attempt on 5.1 and possibly submit a PR if things work out ok.

@jd-lara
Copy link
Contributor

jd-lara commented Jan 21, 2020

An update on 5.1.0 I am currently trying to get the CMAKE to pass everything. Current status:

Re-run cmake no build system arguments
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /opt/bin/x86_64-linux-gnu-gcc
-- Check for working C compiler: /opt/bin/x86_64-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
Appending C release flags
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int64_t
-- Check size of int64_t - done
-- Using int64_t for indices
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- The Fortran compiler identification is GNU 4.8.5
-- Check for working Fortran compiler: /opt/bin/gfortran
-- Check for working Fortran compiler: /opt/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /opt/bin/gfortran supports Fortran 90
-- Checking whether /opt/bin/gfortran supports Fortran 90 -- yes
Appending Fortran release flags
-- Determining Fortran name-mangling scheme... FAILED
-- Looking for LAPACK libraries... OK
-- Checking if LAPACK works... FAILED
CMake Warning at config/SundialsCMakeMacros.cmake:83 (message):
  ------------------------------------------------------------------------

  WARNING: LAPACK not functional

  Blas/Lapack support will not be provided

  ------------------------------------------------------------------------
Call Stack (most recent call first):
  CMakeLists.txt:933 (print_warning)


-- Looking for KLU libraries...
-- Checking if KLU works... OK
-- Added NVECTOR_SERIAL module
-- Added NVECTOR_MANYVECTOR module
-- Added SUNMATRIX_BAND module
-- Added SUNMATRIX_DENSE module
-- Added SUNMATRIX_SPARSE module
-- Added SUNLINSOL_BAND module
-- Added SUNLINSOL_DENSE module
-- Added SUNLINSOL_PCG module
-- Added SUNLINSOL_SPBCGS module
-- Added SUNLINSOL_SPFGMR module
-- Added SUNLINSOL_SPGMR module
-- Added SUNLINSOL_SPTFQMR module
-- Added SUNLINSOL_KLU module
-- Added SUNNONLINSOL_NEWTON module
-- Added SUNNONLINSOL_FIXEDPOINT module
-- Added ARKODE module
-- Added CVODE module
-- Added CVODES module
-- Added IDA module
-- Added IDAS module
-- Added KINSOL module
-- Configuring done
-- Generating done
-- Build files have been written to: /workspace/srcdir/sundials-5.1.0/build

About the Fortran name mangling. The code is here https://github.com/LLNL/sundials/blob/master/config/SundialsFortran.cmake and I implemented the same changes as in the patch to see if it works but I still get the same result.

Determining the proper name mangling scheme in fortran is required for LAPACK to work. Any ideas?

In the new version of Sundials, LAPACK compatibility is checked in the file
https://github.com/LLNL/sundials/blob/master/config/SundialsLapack.cmake

@jd-lara
Copy link
Contributor

jd-lara commented Jan 22, 2020

@giordano @ViralBShah

see LLNL/sundials#23 for updates on the build of Sundials 5.1

@ViralBShah
Copy link
Member

ViralBShah commented Feb 5, 2020

@giordano The reason why none of the libraries are linked against lapack is that we need a new library product - libsundials_sunlinsollapackdense and libsundials_sunlinsollapackband. However, while the library builds, the tests are failing. This suggests that we should disable lapack on sundials 3.1.

The tests with sundials 5.1 are all passing with lapack (#460).

@ViralBShah
Copy link
Member

I've disabled blas and lapack here. This should become a stable build for sundials 3.1.

@ViralBShah ViralBShah changed the title [Sundials] Build with OpenBLAS support [Sundials 3.1] Build with OpenBLAS support Feb 5, 2020
@ViralBShah ViralBShah closed this Feb 7, 2020
@ViralBShah ViralBShah reopened this Feb 7, 2020
@giordano giordano closed this Feb 9, 2020
@giordano giordano reopened this Feb 9, 2020
@ViralBShah ViralBShah merged commit 7eae75f into JuliaPackaging:master Feb 9, 2020
@giordano giordano deleted the sundials-openblas branch February 11, 2020 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants