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

Building MKL.jl fails in v1.6.0 #60

Closed
mihalybaci opened this issue Jan 12, 2021 · 30 comments · Fixed by #78
Closed

Building MKL.jl fails in v1.6.0 #60

mihalybaci opened this issue Jan 12, 2021 · 30 comments · Fixed by #78

Comments

@mihalybaci
Copy link

I am running into errors building MKL.jl in Julia v1.6.0-beta1, and I have confirmed that it builds fine with Julia v1.5.3 ( no errors and BLAS.vendor() returns :mkl. The full message error I get is:

(@v1.6) pkg> build MKL
    Building MKL → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/e01175ff53c062c52b6cbe441a4382e132f7c82e/build.log`
ERROR: Error building `MKL`, showing the last 100 of log: 
best_platform = select_platform(Dict(p => triplet(p) for p in platforms))
dlopen("libjulia", RTLD_LAZY | RTLD_DEEPBIND)

'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:440
  [3] run
    @ ./process.jl:438 [inlined]
  [4] (::Main.anonymous.var"#1#5"{Set{String}, String})(prec_path::String)
    @ Main.anonymous /tmp/jl_Z4lpKw:212
  [5] mktempdir(fn::Main.anonymous.var"#1#5"{Set{String}, String}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:729
  [6] mktempdir
    @ ./file.jl:727 [inlined]
  [7] generate_precompile_statements()
    @ Main.anonymous /tmp/jl_Z4lpKw:195
  [8] top-level scope
    @ /tmp/jl_Z4lpKw:339
  [9] eval(m::Module, e::Any)
    @ Core ./boot.jl:360
 [10] top-level scope
    @ /tmp/jl_Z4lpKw:6
 [11] include(fname::String)
    @ Base.MainInclude ./client.jl:444
 [12] top-level scope
    @ none:33
in expression starting at /tmp/jl_Z4lpKw:3
[ Info: Splicing in code to load MKL in /home/michael/.local/julia-1.6.0-beta1/bin/../share/julia/base/sysimg.jl
[ Info: getting precompile script from: https://raw.githubusercontent.com/JuliaLang/julia/release-1.6/contrib/generate_precompile.jl
Precompiling project...
  ✓ MKL
1 dependency successfully precompiled in 1 seconds (7 already precompiled)
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: LoadError: failed process: Process(`/home/michael/.local/julia-1.6.0-beta1/bin/julia --color=yes --startup-file=no --cpu-target=native --sysimage=/tmp/jl_jPBxgE/sys.ji --project=/tmp/jl_BwAXby --output-o=/tmp/jl_tTeUfB.o -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "/home/michael/.local/julia-1.6.0-beta1/share/julia/stdlib/v1.6"
Base.init_load_path()
if isdefined(Base, :init_active_project)
    Base.init_active_project()
end
Base.init_depot_path()
# This @eval prevents symbols from being put into Main
@eval Module() begin
    PrecompileStagingArea = Module()
    for (_pkgid, _mod) in Base.loaded_modules
        if !(_pkgid.name in ("Main", "Core", "Base"))
            eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
        end
    end
    precompile_files = String[
        "/tmp/jl_b29gfy"
    ]
    for file in precompile_files, statement in eachline(file)
        # println(statement)
        # The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
        # N with a large number seems to work around it.
        statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
        try
            Base.include_string(PrecompileStagingArea, statement)
        catch
            # See julia issue #28808
            @debug "failed to execute $statement"
        end
    end
end # module
include("/tmp/jl_Z4lpKw")
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:440
  [3] run
    @ ./process.jl:438 [inlined]
  [4] create_sysimg_object_file(object_file::String, packages::Vector{String}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::String, isapp::Bool)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/3BsME/src/PackageCompiler.jl:306
  [5] create_sysimage(packages::Vector{Symbol}; sysimage_path::Nothing, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::String, base_sysimage::Nothing, isapp::Bool)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/3BsME/src/PackageCompiler.jl:442
  [6] top-level scope
    @ ~/.julia/packages/MKL/1aXoN/src/install.jl:128
  [7] eval
    @ ./boot.jl:360 [inlined]
  [8] change_blas_library(libblas::String)
    @ Main ~/.julia/packages/MKL/1aXoN/src/install.jl:126
  [9] enable_mkl_startup()
    @ Main ~/.julia/packages/MKL/1aXoN/src/install.jl:103
 [10] top-level scope
    @ ~/.julia/packages/MKL/1aXoN/deps/build.jl:9
 [11] include(fname::String)
    @ Base.MainInclude ./client.jl:444
 [12] top-level scope
in expression starting at /home/michael/.julia/packages/MKL/1aXoN/deps/build.jl:9

My versioninfo() is:

Julia Version 1.6.0-beta1
Commit b84990e1ac (2021-01-08 12:42 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, haswell)
Environment:
  JULIA_NUM_THREADS = 8

Let me know if there is any other information you need.

@mtfishman
Copy link

I get a similar error with:

julia> versioninfo()
Julia Version 1.6.0-beta1
Commit b84990e1ac (2021-01-08 12:42 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) E-2176M  CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, skylake)

@pablosanjose
Copy link

I confirm the same error arises with

julia> versioninfo()
Julia Version 1.7.0-DEV.320
Commit 7647ab574f (2021-01-15 22:52 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = code

(I'm using macos Big Sur 11.1. Before arriving at this error I get a permission error when trying to write to the share folder inside the Julia-1.7.app package, where the sysimg.jl sits. That is easily overcome by giving my user write permission to the share folder)

@ViralBShah
Copy link
Contributor

ViralBShah commented Jan 22, 2021

Is this in /Applications? I usually always install julia in my home directory - where I suppose I have permissions to write and hence didn't run into this issue.

@pablosanjose
Copy link

pablosanjose commented Jan 23, 2021

The problem is writing inside the .app package. It doesn't matter whether I install it in /Applications or /Users/Shared. I still have to enable write permissions to my user for the files inside the package.

EDIT: I believe the issue happens in Big Sur, but I think it didn't happen in Mojave. I certainly did not encounter it until I upgraded.

@pablosanjose
Copy link

Friendly bump

@ViralBShah
Copy link
Contributor

What if you install the app in your own home directory? Not really an MKL.jl issue, I suppose.

@pablosanjose
Copy link

Nope, same error. I also tried building MKL.jl in a julia build from source, not packagaged into an app. Same issue.

@mihalybaci
Copy link
Author

I just downloaded the julia-1.6.0-rc1 binaries, and MKL.jl still fails to build. The first two lines in the log are:

ERROR: ArgumentError: Package Artifacts not found in current path:
- Run `import Pkg; Pkg.add("Artifacts")` to install the Artifacts package.

The rest of the log is the stacktrace for that error. I checked Pkg and everything appears normal

(@v1.6) pkg> st
      Status `~/.julia/environments/v1.6/Project.toml`
  [33e6dc65] MKL v0.3.0
  [56f22d72] Artifacts

I am not sure why it can't find the package. Everything is in local, non-root directories (and this is my home computer so I do have root access in any case).

@mihalybaci mihalybaci changed the title Building MKL.jl fails in v1.6.0-beta1 Building MKL.jl fails in v1.6.0-beta1 and v1.6.0-rc1 Feb 8, 2021
@dmbates
Copy link

dmbates commented Feb 22, 2021

I am encountering the same problem under Linux (Ubuntu 20.10) with v1.6.0-rc1 and with v1.7.0-DEV.593. Could the problem be related to the Artifacts package being a stdlib in v1.6+ and not a submodule of Pkg?

@ViralBShah
Copy link
Contributor

ViralBShah commented Feb 22, 2021

@dmbates 1.7 is going to make this really easy once JuliaLang/julia#39455 is merged. Will no longer need to be built into the system image. We naturally need to fix the issue in 1.6, and perhaps @KristofferC may know what's going on.

@dmbates
Copy link

dmbates commented Feb 22, 2021

The relevant section in sysimg.jl after the insertion of the MKL loading code is, in my case starting at line 88

        Base._track_dependencies[] = true
# START MKL INSERT
pushfirst!(LOAD_PATH, "@v#.#")
pushfirst!(LOAD_PATH, "@")
MKL = Base.require(Base, :MKL)
MKL.MKL_jll.__init__()
MKL.__init__()
popfirst!(LOAD_PATH)
popfirst!(LOAD_PATH)
# END MKL INSERT
        tot_time_stdlib = @elapsed for stdlib in stdlibs
            tt = @elapsed Base.require(Base, stdlib)
            print_time(stdlib, tt)
        end

So MKL is going to be loaded before the stdlibs, which is necessary so that LinearAlgebra already has MKL loaded. However, MKL will require MKL_jll which will require Artifacts to ensure that the dll has been installed. Is there a sequencing problem here because of that?

@dmbates
Copy link

dmbates commented Feb 22, 2021

That's great news, @ViralBShah . I look forward to working with it under v1.7 and, I hope, also under v1.6.

The reason I am excited about it is I recently bought a laptop that has a 11th gen Intel core processor which supports avx512. In my typical benchmark for the MixedModels package MKL would give maybe a 30% speed boost relative to OpenBLAS on older processors. On this processor the benchmark evaluation of an objective went from 9.6 ms to 3.2 ms when using MKL. At first I thought it was a mistake and couldn't possibly be that fast but it is.

@ViralBShah
Copy link
Contributor

ViralBShah commented Feb 22, 2021

Can you try 1.7 master? We were quite behind on openblas versions (due to bugs in openblas), but yesterday, we merged the move to 0.3.13 on 1.7 master. @chriselrod may also be interested in understanding the performance issues and if any of his packages could help.

@mihalybaci
Copy link
Author

mihalybaci commented Feb 22, 2021

Aha! I may have hacked my way to a solution. I am far out of my depth here, but essentially, it just necessary to add Artifacts.jl as a dependency for both PackageCompiler and MKL. Here is what I did.

  1. dev PackageCompiler
  2. `cd ~./julia/dev/PackageCompiler
  3. ] activate .
  4. add Artifacts
  5. Insert the line using Artifacts to PackageCompiler/src/PackageCompiler.jl
  6. dev MKL
  7. cd ~/.julia/dev/MKL
  8. ] activate .
  9. add Artifacts
  10. Insert using Artifacts to MKL/src/MKL.jl and MKL/deps/build.jl
  11. Then go back to the main v1.6 environment and build MKL

It seems to have worked since BLAS.vendor() does in fact return :mkl.

(edit: added steps to cd into directories and then ] activate .)

@dmbates
Copy link

dmbates commented Feb 22, 2021

Can you try 1.7 master? We were quite behind on openblas versions (due to bugs in openblas), but yesterday, we merged the move to 0.3.13 on 1.7 master. @chriselrod may also be interested in understanding the performance issues and if any of his packages could help.

Similar result as before

julia> @benchmark objective(updateL!(setθ!($m6,$θ6)))
BenchmarkTools.Trial: 
  memory estimate:  1.14 KiB
  allocs estimate:  65
  --------------
  minimum time:     9.411 ms (0.00% GC)
  median time:      9.445 ms (0.00% GC)
  mean time:        9.503 ms (0.00% GC)
  maximum time:     10.808 ms (0.00% GC)
  --------------
  samples:          526
  evals/sample:     1

julia> using LinearAlgebra

julia> BLAS.openblas_get_config()
"OpenBLAS 0.3.13  USE64BITINT DYNAMIC_ARCH NO_AFFINITY Prescott MAX_THREADS=32"

I will watch the status of JuliaLang/julia#39455 and try to use MKL once it has been merged. The changes in v1.6 and v1.7, especially with respect to precompilation, are just amazing and I look forward to enjoying them along with MKL.

@chriselrod
Copy link

What functions do you need? Not much aside from gemm has been implemented, but multithreaded gemm beats multithreaded MKL by a bit on recent Intel <= 100x100 (and by a lot with AMD Ryzen) and is competitive into a few thousand square. And far ahead of everything else in that smallish range.
Recent benchmarks start here: JuliaLinearAlgebra/Octavian.jl#24 (comment)
If you need things like QR decomposition and triangular solves, those aren't implemented yet. But the gemm benchmarks are encouraging.

@dmbates
Copy link

dmbates commented Feb 23, 2021

@chriselrod Thanks for the pointer to Octavian. The core calculation in the example I mentioned is evaluating a symmetric product of the form T'AT + I where T is lower triangular, A is symmetric, and I is the identity, then evaluating a blocked Cholesky factor of a matrix that contains this in the upper-left block. Both T and A are diagonal or block diagonal with small blocks. Some of the calculations are gemm-like but others are triangular multiplications or solves. Exactly which part dominates depends to some extent on the BLAS being used but there are definitely intensive uses of in-place triangular multiplications and solves.

@ViralBShah
Copy link
Contributor

I have a native multi-threaded LU: https://github.com/ViralBShah/HPL.jl/blob/master/src/hpl_shared.jl

It should be straightforward to convert to cholesky (and needs to probably be tested and made robust). All the work done is in small gemm kernels, but needs a few other pieces. Those could just be converted by hand to native Julia with simple implementations to start with. The big one I suppose is the triangular solve.

@mihalybaci mihalybaci changed the title Building MKL.jl fails in v1.6.0-beta1 and v1.6.0-rc1 Building MKL.jl fails in v1.6.0 Mar 26, 2021
@mihalybaci
Copy link
Author

I just tested adding MKL on v1.6.0, and this time it failed at the install step, rather than the build step. Here is the full stacktrace.

(@v1.6) pkg> add MKL
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
   Installed MKL ───────────── v0.4.0
   Installed PackageCompiler ─ v1.2.5
    Updating `~/.julia/environments/v1.6/Project.toml`
  [33e6dc65] + MKL v0.4.0
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [33e6dc65] + MKL v0.4.0
  [9b87118b] + PackageCompiler v1.2.5
    Building MKL → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/52c39a2b156743873c3919cd8ce83ac6075cc45f/build.log`
ERROR: Error building `MKL`, showing the last 100 of log: 
dlopen("libjulia", RTLD_LAZY | RTLD_DEEPBIND)

'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:440
  [3] run
    @ ./process.jl:438 [inlined]
  [4] (::Main.anonymous.var"#1#5"{Set{String}, String})(prec_path::String)
    @ Main.anonymous /tmp/jl_CzFlQd:212
  [5] mktempdir(fn::Main.anonymous.var"#1#5"{Set{String}, String}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:729
  [6] mktempdir (repeats 2 times)
    @ ./file.jl:727 [inlined]
  [7] generate_precompile_statements()
    @ Main.anonymous /tmp/jl_CzFlQd:195
  [8] top-level scope
    @ /tmp/jl_CzFlQd:339
  [9] eval(m::Module, e::Any)
    @ Core ./boot.jl:360
 [10] top-level scope
    @ /tmp/jl_CzFlQd:6
 [11] include(fname::String)
    @ Base.MainInclude ./client.jl:444
 [12] top-level scope
    @ none:33
in expression starting at /tmp/jl_CzFlQd:3
 Downloading artifact: MKL
[ Info: Splicing in code to load MKL in /home/michael/.local/julia-1.6.0/bin/../share/julia/base/sysimg.jl
[ Info: getting precompile script from: https://raw.githubusercontent.com/JuliaLang/julia/release-1.6/contrib/generate_precompile.jl
Precompiling project...
  ✓ MKL
1 dependency successfully precompiled in 1 seconds (7 already precompiled)
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: LoadError: failed process: Process(`/home/michael/.local/julia-1.6.0/bin/julia --color=yes --startup-file=no --cpu-target=native --sysimage=/tmp/jl_KScCGV/sys.ji --project=/tmp/jl_bIqpxC --output-o=/tmp/jl_IBWdbr.o -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "/home/michael/.local/julia-1.6.0/share/julia/stdlib/v1.6"
Base.init_load_path()
if isdefined(Base, :init_active_project)
    Base.init_active_project()
end
Base.init_depot_path()
# This @eval prevents symbols from being put into Main
@eval Module() begin
    PrecompileStagingArea = Module()
    for (_pkgid, _mod) in Base.loaded_modules
        if !(_pkgid.name in ("Main", "Core", "Base"))
            eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
        end
    end
    precompile_files = String[
        "/tmp/jl_ezSPFW"
    ]
    for file in precompile_files, statement in eachline(file)
        # println(statement)
        # The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
        # N with a large number seems to work around it.
        statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
        try
            Base.include_string(PrecompileStagingArea, statement)
        catch
            # See julia issue #28808
            @debug "failed to execute $statement"
        end
    end
end # module
include("/tmp/jl_CzFlQd")
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base ./process.jl:440
  [3] run
    @ ./process.jl:438 [inlined]
  [4] create_sysimg_object_file(object_file::String, packages::Vector{String}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::String, isapp::Bool)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/3BsME/src/PackageCompiler.jl:306
  [5] create_sysimage(packages::Vector{Symbol}; sysimage_path::Nothing, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::String, base_sysimage::Nothing, isapp::Bool)
    @ PackageCompiler ~/.julia/packages/PackageCompiler/3BsME/src/PackageCompiler.jl:442
  [6] top-level scope
    @ ~/.julia/packages/MKL/3H9w2/src/install.jl:128
  [7] eval
    @ ./boot.jl:360 [inlined]
  [8] change_blas_library(libblas::String)
    @ Main ~/.julia/packages/MKL/3H9w2/src/install.jl:126
  [9] enable_mkl_startup()
    @ Main ~/.julia/packages/MKL/3H9w2/src/install.jl:103
 [10] top-level scope
    @ ~/.julia/packages/MKL/3H9w2/deps/build.jl:13
 [11] include(fname::String)
    @ Base.MainInclude ./client.jl:444
 [12] top-level scope
    @ none:5
in expression starting at /home/michael/.julia/packages/MKL/3H9w2/deps/build.jl:13

Full log at /home/michael/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/52c39a2b156743873c3919cd8ce83ac6075cc45f/build.log

Still has the same problem as before, the first two lines of the builg.log are

ERROR: ArgumentError: Package Artifacts not found in current path:
- Run `import Pkg; Pkg.add("Artifacts")` to install the Artifacts package.

I presume my workaround from before will still work.

@jtschneider
Copy link

jtschneider commented Mar 26, 2021

Would the proposition from #60 (comment) be suitable to fix this issue? I am wondering especially because v1.6 has been officially released and MKL.jl still fails to build on several machines.

@mihalybaci
Copy link
Author

I just confirmed that my workaround still works.

@jtschneider
Copy link

jtschneider commented Mar 26, 2021

I just confirmed that your workaround @mihalybaci can be cut short by only adding Artifacts and Pkg to MKL.jl :

(v1.6) pkg> dev MKL
     Cloning git-repo `https://github.com/JuliaLinearAlgebra/MKL.jl.git`
   Resolving package versions...
    Updating `~/.julia/environments/v1.6/Project.toml`
  [33e6dc65] ~ MKL v0.4.0  v0.4.0 `~/.julia/dev/MKL`
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [33e6dc65] ~ MKL v0.4.0  v0.4.0 `~/.julia/dev/MKL`
    Building MKL  `~/.julia/dev/MKL/deps/build.log`

(v1.6) pkg> activate MKL

(MKL) pkg> add Pkg, Artifacts
    Updating registry at `~/.julia/registries/General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
    Updating `~/.julia/dev/MKL/Project.toml`
  [44cfe95a] + Pkg
  [56f22d72] + Artifacts
  No Changes to `~.julia/dev/MKL/Manifest.toml`

julia> Pkg.build("MKL", verbose=true)
    Building MKL  `~/.julia/dev/MKL/deps/build.log`
[ Info: Splicing in code to load MKL in ~/julia-1.6.0/bin/../share/julia/base/sysimg.jl
[ Info: getting precompile script from: https://raw.githubusercontent.com/JuliaLang/julia/release-1.6/contrib/generate_precompile.jl
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...
Generating REPL precompile statements... 29/29
Executing precompile statements... 1312/1312
Precompilation complete. Summary:
Total ─────── 138.887458 seconds
Generation ── 106.085874 seconds 76.3826%
Execution ───  32.801584 seconds 23.6174%
[ Info: PackageCompiler: default sysimg replaced, restart Julia for the new sysimg to be in effect

Weirdly, only adding Pkg does not resolve the issue...
I suspect this fix would require MKL to only work with Julia >= v1.6 as Artifacts became a separate package in the Standard Library only in v1.6 [1].

@mihalybaci
Copy link
Author

@jtschneider - do you use the Julia VS Code extension? Both your version and mine work to set BLAS.vendor() = :MKL, but something about the sysimage created causes my VS code extension to crash. I only figured this out after removing/installing Julia itself (removing packages wasn't enough).

@jtschneider
Copy link

@jtschneider - do you use the Julia VS Code extension? Both your version and mine work to set BLAS.vendor() = :MKL, but something about the sysimage created causes my VS code extension to crash. I only figured this out after removing/installing Julia itself (removing packages wasn't enough).

I do use VS code with the Julia extension, also on a machine where I just built the sysimage against MKL. However, it appears I do not have the same issue that you describe;

[ Info: Precompiling VSCodeServer [9f5989ce-84fe-42d4-91ec-6a7a8d53ed0f]
julia> using LinearAlgebra

julia> BLAS.vendor()
:mkl 

I can open the REPL inside VSCode without any trouble (see above) and the LanguageServer is indexing my Packages in the (new) environment (v1.6)

@pablosanjose
Copy link

I see that MKL now works great in 1.7 through the beautiful BLAS trampoline machinery. Given the kludgy (in comparison) sysimg hijacking approach of MKL.jl in 1.6 and earlier, wouldn't it make sense to restrict MKL.jl to 1.7 and later? Does it make sense to maintain the older approach?

@Maximilian-Stefan-Ernst
Copy link

@mihalybaci I had the same issue with MKL and my VS Code extension is now crashing too, so I'm curious if you finally figured out how to use VS Code + MKL + Julia 1.6...

@mihalybaci
Copy link
Author

I never did figure out a solution. At the moment, I'm not doing anything where the difference between OpenBLAS and MKL really matters, so I haven't really tried. But since @jtschneider says that they're VS Code works, I figured it must be my environment, either within Julia or its packages, or how I've set up my VS code extension, though, as I mentioned in this issue julia-vscode/julia-vscode#1990 I tried a few things and only after removing my .julia folder did it work. But that was before I found the connection with MKL.

@mtfishman
Copy link

@pablosanjose, I think it would be unfortunate for MKL.jl to not support Julia v1.6. We tell our users to use MKL.jl to get the best performance for our package, I wouldn't want to tell them that to use MKL they have to build Julia from source or patch MKL.jl themselves.

@ViralBShah
Copy link
Contributor

@pablosanjose The way this package is set up right now, it will use the new LBT mechanism on Julia 1.7 and newer, and the older mechanism on anything up to 1.6. Of course, currently, this seems broken for 1.6.

@tbenst
Copy link

tbenst commented Apr 27, 2021

following workaround from @jtschneider, I'm seeing the following error in julia-vscode: julia-vscode/julia-vscode#2124. Any ideas how to troubleshoot?

InitError(mod=:IntelOpenMP_jll, error=ErrorException("Artifact "IntelOpenMP" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources."))
error at ./error.jl:33

@mihalybaci did you ever find a workaround..?

danielwe added a commit to danielwe/MKL.jl that referenced this issue May 4, 2021
KristofferC pushed a commit to danielwe/MKL.jl that referenced this issue May 25, 2021
KristofferC added a commit that referenced this issue May 25, 2021
* Add Artifacts as dependency, fixes #60.

* correct location for inserting MKL stub

Co-authored-by: KristofferC <[email protected]>
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 a pull request may close this issue.

9 participants