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

Workaround for julia compiled with MKL? #428

Closed
Djoop opened this issue Mar 4, 2019 · 2 comments
Closed

Workaround for julia compiled with MKL? #428

Djoop opened this issue Mar 4, 2019 · 2 comments

Comments

@Djoop
Copy link

Djoop commented Mar 4, 2019

I know that there are issues when both Julia and python use MKL (#100, #165, JuliaPy/PyCall.jl#443 ). I'm only using python for PyPlot, so using MKL is not critical, I thought I could just as a workaround link python libraries to openblas to avoid the problem. I tried ENV["PYTHON"]=""; Pkg.build("PyCall") (#165 (comment)), but it was still using MKL. So I manually installed nomkl in a clean environment:

julia> Conda.add("nomkl")

Now the packages indeed do not rely on MKL, e.g. for numpy:

julia> Pkg.build("PyCall")
julia> using PyCall
julia> np = pyimport("numpy")
julia> np.show_config()
lapack_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/UNAME/.conda/envs/nomkl/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_opt_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/UNAME/.conda/envs/nomkl/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/UNAME/.conda/envs/nomkl/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blis_info:
  NOT AVAILABLE
openblas_lapack_info:
    libraries = ['openblas', 'openblas']
    library_dirs = ['/home/UNAME/.conda/envs/nomkl/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE

but I still get a segfault when I try to use PyPlot:

julia> plot([1,2,3])
signal (11): Erreur de segmentation
in expression starting at no file:0
[1]    20255 segmentation fault (core dumped)  julia

Is it expected? Any idea how to set up with Conda an environment that can be used for PyPlot when julia is compiled with MKL (well, I guess that's the issue, but maybe there is another problem)?
Plotting works correctly when calling python directly.

For reference:

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202* (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
@stevengj
Copy link
Member

stevengj commented Mar 4, 2019

The problem is that NumPy still links OpenBLAS with the same function names as MKL, because both of them implement the same BLAS interface (e.g. functions like dgemm), so they still conflict.

(In contrast, when Julia is linked with 64-bit OpenBLAS, it links a special version with "mangled" symbols that don't conflict with other BLAS libraries.)

In short, Julia linked with the 64-bit MKL is basically unusable with numpy.

@stevengj stevengj closed this as completed Mar 4, 2019
@cauachagas
Copy link

I have Julia compiled from the source with MKL (Manjaro Linux). I solved the problem using a non-iterative backend for matplotlib.

In ~/.bashrc

# export MPLBACKEND=WebAgg # works with REPL, But if you move the pointer over the picture it will break
export MPLBACKEND="module://gr.matplotlib.backend_gr"

Now in Julia

Captura de tela_2020-07-05_22-14-00

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

3 participants