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

better handling of the build process: using julia built against mkl #61

Closed
daviehh opened this issue Feb 25, 2019 · 2 comments
Closed

Comments

@daviehh
Copy link
Collaborator

daviehh commented Feb 25, 2019

Following this discussion here, one can supply a self-built arpack binary (esp. built against mkl). For this particular problem, this can be handled in a cleaner/better documented way. e.g. for deps/build.jl, add something like:

if Base.libblas_name == "libopenblas64_"
   (use openblas)
else
  (use user provided path to arpack binary, passed as argument from Pkg.build)
end

via manually pasting a compiled binary to ~/.julia/packages/Arpack/<pkg hash>/deps/usr/lib, I can get Pkg.test("Arpack") pass on a mac using a modified script from the binary builder script, using commit "b095052372aa95d4281a645ee1e367c28255c947" of arpack-ng.git:

#!/usr/bin/env bash
source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64

CMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,$MKLROOT/lib"



# Symbols that have float32, float64, complexf32, and complexf64 support
SDCZ_SYMBOLS="axpy copy gemv geqr2 lacpy lahqr lanhs larnv lartg \
              lascl laset scal trevc trmm trsen gbmv gbtrf gbtrs \
              gttrf gttrs pttrf pttrs"
# All symbols that have float32/float64 support (including the SDCZ_SYMBOLS above)
SD_SYMBOLS="${SDCZ_SYMBOLS} dot ger labad laev2 lamch lanst lanv2 \
            lapy2 larf larfg lasr nrm2 orm2r rot steqr swap"
# All symbols that have complexf32/complexf64 support (including the SDCZ_SYMBOLS above)
CZ_SYMBOLS="${SDCZ_SYMBOLS} dotc geru unm2r"
# Add in (s|d)*_64 symbol remappings:
for sym in ${SD_SYMBOLS}; do
    SYMBOL_DEFS="${SYMBOL_DEFS} -Ds${sym}=s${sym}_64 -Dd${sym}=d${sym}_64"
done
# Add in (c|z)*_64 symbol remappings:
for sym in ${CZ_SYMBOLS}; do
    SYMBOL_DEFS="${SYMBOL_DEFS} -Dc${sym}=c${sym}_64 -Dz${sym}=z${sym}_64"
done
# Add one-off symbol mappings; things that don't fit into any other bucket:
for sym in scnrm2 dznrm2 csscal zdscal dgetrf dgetrs; do
    SYMBOL_DEFS="${SYMBOL_DEFS} -D${sym}=${sym}_64"
done
# Set up not only lowercase symbol remappings, but uppercase as well:
SYMBOL_DEFS="${SYMBOL_DEFS} ${SYMBOL_DEFS^^}"

FFLAGS="${FFLAGS} -fdefault-integer-8 ${SYMBOL_DEFS} -ff2c"

cmake ..  -DINTERFACE64=1 -DBUILD_SHARED_LIBS=ON -DBLAS_LIBRARIES="-L$MKLROOT/lib -lmkl_rt" -DLAPACK_LIBRARIES="-L$MKLROOT/lib -lmkl_rt" -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" -DCMAKE_Fortran_FLAGS="${FFLAGS}"

Additional question: if Pkg.test("Arpack") pass, is it safe to assume that the self-built binary is compatible? Thanks!

@daviehh
Copy link
Collaborator Author

daviehh commented Feb 25, 2019

note: changes to the script:

  • set env variable to set mkl path via source /opt/intel/mkl/bin/mklvars.sh intel64 ilp64
  • CMAKE_EXE_LINKER_FLAGS: added -Wl,$MKLROOT/lib
  • FFLAGS added -ff2c as per here
  • cmake .. -DINTERFACE64=1 -DBUILD_SHARED_LIBS=ON -DBLAS_LIBRARIES="-L$MKLROOT/lib -lmkl_rt" -DLAPACK_LIBRARIES="-L$MKLROOT/lib -lmkl_rt" -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" -DCMAKE_Fortran_FLAGS="${FFLAGS}"

@andreasnoack
Copy link
Member

Dup of JuliaLang/julia#7

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

No branches or pull requests

2 participants