MKL.jl icon indicating copy to clipboard operation
MKL.jl copied to clipboard

Allow specifying custom location for MKL

Open alyst opened this issue 4 years ago • 5 comments

Allows specifying custom paths that would be used for MKL injection into sysimg.jl. The paths default to the current ["@v#.#", "@"], but could be explicitly specified when calling enable_mkl_startup(), or via the JULIA_MKL_LOAD_PATH environment variable (so that it would be picked up when building sysimg upon Pkg.add(MKL)).

The motivation Now that building Julia in ArchLinux is broken (due to http-parser/libgit2 incompatibilities, see JuliaLang/julia#34785), this PR allows using the official Julia binaries to build MKL-enabled ArchLinux package. I install MKL into /usr/share/julia/site using this AUR script snippet:

...

build() {
  # rebuild sysimage with MKL support
  SITE_DEPOT_PATH=${srcdir}/julia-${pkgver}/share/julia/site
  rm -rf ${SITE_DEPOT_PATH}
  mkdir -p ${SITE_DEPOT_PATH}
  JULIA_LOAD_PATH="${SITE_DEPOT_PATH}:@stdlib" \
  JULIA_DEPOT_PATH=${SITE_DEPOT_PATH} \
  JULIA_MKL_LOAD_PATH="${SITE_DEPOT_PATH}" \
  ${srcdir}/julia-${pkgver}/bin/julia \
    -H ${srcdir}/julia-${pkgver}/bin \
    --startup-file=no \
    --project=${SITE_DEPOT_PATH} \
    ${srcdir}/build_sysimg_with_mkl.jl
}

package() {
  mkdir -p ${pkgdir}/usr/share/licenses/julia
  cp -r julia-${pkgver}/{bin,etc,include,lib,share} ${pkgdir}/usr/
  rm -rf ${pkgdir}/usr/share/julia/site/{artifacts,clones,logs,registries}
  sed "s!${srcdir}/julia-${pkgver}!/usr!" -i ${pkgdir}/usr/share/julia/base/sysimg.jl 
  install -Dm644 julia-${pkgver}/LICENSE.md \
      ${pkgdir}/usr/share/licenses/julia/LICENSE.md
}

build_sysimg_with_mkl.jl is just:

using Pkg
Pkg.add(PackageSpec(url="https://github.com/alyst/MKL.jl", rev="custom_pkg_location"))

alyst avatar Mar 12 '20 18:03 alyst