JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.73k stars 5.48k forks source link

icc Build fails for Julia-0.6 on Ubuntu #21929

Closed GravityAssisted closed 7 years ago

GravityAssisted commented 7 years ago

Hi,

I am trying to to compile the Julia 0.6-rc1 in Ubuntu and I getting an LLVM compilation error

Internal error loop: assertion failed: find_seq_in_lookup_table: seq_number not found (shared/cfe/edgcpfe/il.c, line 4039)

compilation aborted for /home/arora/src/julia_src/julia/deps/srccache/llvm-3.9.1/lib/LTO/ThinLTOCodeGenerator.cpp (code 4)
lib/LTO/CMakeFiles/LLVMLTO.dir/build.make:158: recipe for target 'lib/LTO/CMakeFiles/LLVMLTO.dir/ThinLTOCodeGenerator.cpp.o' failed

The complete GIST output is found here: https://gist.github.com/GravityAssisted/e8b6239e101f3d9992322d15a454bbad

My Make.user file looks like:

USEICC = 1
USEIFC = 1
USE_INTEL_MKL = 1
USE_INTEL_MKL_FFT = 1
USE_INTEL_LIBM = 1

I checked out the 0.6 Julia as follows:

git checkout release-0.6

Is this an expected issue as Julia 0.6 is still at RC1 ?

thanks

GravityAssisted commented 7 years ago

BTW: My ICC, icpc and ifort versions are 16.03.

icc version 16.0.3 (gcc version 5.0.0 compatibility)
icpc version 16.0.3 (gcc version 5.0.0 compatibility)

my gcc version is 5.4:

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 

I aware of this issue https://software.intel.com/en-us/forums/intel-c-compiler/topic/565143

yuyichao commented 7 years ago

Based on the error message I believe this is a ICC crashing when compiling LLVM https://software.intel.com/en-us/forums/intel-c-compiler/topic/278558

GravityAssisted commented 7 years ago

Thanks! Is it possible to fix this on our end ? or do we have to wait for Intel and cant use MKL or ICC until then ?

yuyichao commented 7 years ago

P.S. the link above probably isn't the icc bug you are hitting. It was just a quick search based on the file name. Googling the full error message leads to https://software.intel.com/en-us/forums/intel-c-compiler/topic/673768 which seems to suggest that this is fixed in icc 17.0 . Given this is in LLVM and the thread suggests that there isn't a simple workaround I'll close this and assume the only fix is by using gcc or upgrading icc. Feel free to comment for reopenning / open new ones if icc upgrade doesn't solve it.

andreasnoack commented 7 years ago

Use can use MKL without using the Intel compilers

GravityAssisted commented 7 years ago

Thanks, sounds good. I also found that fix. Will report back about updating icc. @andreasnoack I will try that for now, until I get this fixed.

tkelman commented 7 years ago

does that actually work and pass tests given the different fortran calling convention?

andreasnoack commented 7 years ago

Seems to be the case. I actually thought the arpack.jl tests would fail but they don't on my machine.

tkelman commented 7 years ago

what changed?

andreasnoack commented 7 years ago

Don't know

GravityAssisted commented 7 years ago

So the Intel MKL compiled just fine if I dont use ICC and ICPC compilers. Make.user:

USE_INTEL_MKL = 1
USE_INTEL_MKL_FFT = 1
USE_INTEL_LIBM = 1

Here is my version info:

julia> versioninfo()
Julia Version 0.6.0-rc1.3
Commit c302d75 (2017-05-14 09:56 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz
  WORD_SIZE: 64
  BLAS: libmkl_rt
  LAPACK: libmkl_rt
  LIBM: libimf
  LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
tkelman commented 7 years ago

and does make test pass?

GravityAssisted commented 7 years ago

You are correct @tkelman . The test fails. Here is the gist: https://gist.github.com/GravityAssisted/d476810759858b31e97d4bc833fecdb1

So looks like I have to use ICC and ICPC if I want to use MKL, right ?

tkelman commented 7 years ago

ifort is the important part, if you want anything involving arpack (eigs) or complex dot products to work

GravityAssisted commented 7 years ago

Look like the recommended Make.user on the main GIT page doesn't even have ifort explicitly listed: Recommended Make.user for intel compiler and MKL:


USEICC = 1
USEIFC = 1
USE_INTEL_MKL = 1
USE_INTEL_MKL_FFT = 1
USE_INTEL_LIBM = 1
yuyichao commented 7 years ago

USEIFC = 1 ???

GravityAssisted commented 7 years ago

@yuyichao Ha! My Bad. I am soo sleep deprived. I forgot to read that properly.

I am updating ICC/Ifort this weekend and report back on the results then.

thanks all.

m-j-w commented 7 years ago

Adding -ff2c to FFLAGS in Make.user in addition to USE_INTEL_MKL works fine for me using gfortran on Ubuntu 16.04 for quite some time now.

As proof of concept: My current Make.user reads

# <Julia>/Make.user

# `-ff2c` enables Fortran standard calling convention,
# making gfortran compatible with MKL
FFLAGS   := -O3 -fomit-frame-pointer -march=native -ff2c -fexternal-blas -w
CFLAGS   := -march=native -w -Wno-unused-variable \
                 -Wno-unused-but-set-variable -Wno-unused-const-variable \
                 -Wno-misleading-indentation
CXXFLAGS := $(CFLAGS)

USE_INTEL_MKL := 1
USE_INTEL_MKL_FFT := 0
USE_INTEL_LIBM := 0
USEICC := 0
USEIFC := 0

The above also disables most warning messages and enables some more aggressive optimisations. But it might make debugging more difficult. You may reduce the above to only enable MKL and change the calling convention with

# Minimal <Juli>/Make.user to enable MKL with gfortran (untested)
FFLAGS   := -ff2c
USE_INTEL_MKL := 1

For my own Make.user, LinAlg tests pass, including arnoldi. (current master)

# make test
    JULIA test/all
Test (Worker)             | Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)
WARNING: Method definition ambig(Any, Integer) in module Test57Main_ambiguous at /home/mjw/src/julia-master/test/ambiguous.jl:7 overwritten at /home/mjw/src/julia-master/test/ambiguous.jl:85.
    From worker 2:  Skipping Base.<|
    From worker 2:  Skipping Base.active_repl
    From worker 2:  Skipping Base.active_repl_backend
    From worker 2:  Skipping Base.<|
    From worker 2:  Skipping Base.active_repl
    From worker 2:  Skipping Base.active_repl_backend
ambiguous (2)             |    1.78  |  0.08  |  4.4 | 39.92      | 220.57  
linalg/qr (4)             |   61.51  |  0.85  |  1.4 | 2217.24    | 332.12  
linalg/schur (4)          |    6.46  |  0.11  |  1.7 | 365.83     | 354.80  
linalg/matmul (2)         |   73.28  |  0.65  |  0.9 | 3196.37    | 322.02  
linalg/special (4)        |   13.78  |  0.17  |  1.2 | 434.60     | 368.77  
linalg/dense (5)          |   92.05  |  1.06  |  1.2 | 3481.88    | 369.93  
linalg/svd (5)            |    5.77  |  0.07  |  1.1 | 160.71     | 376.06  
linalg/eigen (2)          |   24.89  |  0.24  |  1.0 | 790.60     | 363.62  
linalg/bunchkaufman (4)   |   23.68  |  0.22  |  0.9 | 700.80     | 395.26  
linalg/lapack (5)         |   15.80  |  0.34  |  2.1 | 724.97     | 391.14  
linalg/tridiag (2)        |   19.60  |  0.34  |  1.7 | 773.61     | 386.24  
linalg/pinv (2)           |    4.83  |  0.12  |  2.4 | 663.85     | 453.97  
linalg/givens (2)         |    3.13  |  0.03  |  1.0 | 95.85      | 453.97  
linalg/bidiag (4)         |   26.22  |  0.47  |  1.8 | 859.46     | 432.29  
linalg/diagonal (5)       |   33.17  |  0.40  |  1.2 | 828.27     | 427.88  
linalg/symmetric (5)      |    9.49  |  0.13  |  1.4 | 272.91     | 448.22  
linalg/lu (4)             |   25.36  |  0.63  |  2.5 | 1071.64    | 473.25  
linalg/generic (5)        |    5.85  |  0.08  |  1.3 | 156.12     | 452.44  
linalg/cholesky (2)       |   38.51  |  0.43  |  1.1 | 925.48     | 453.97  
linalg/hessenberg (2)     |    0.71  |  0.01  |  1.3 | 20.53      | 453.97  
linalg/uniformscaling (4) |   10.42  |  0.17  |  1.6 | 273.93     | 497.30  
linalg/conjarray (4)      |    1.08  |  0.01  |  1.2 | 28.16      | 497.34  
linalg/rowvector (2)      |   13.64  |  0.17  |  1.3 | 389.13     | 455.26  
linalg/arnoldi (4)        |   17.12  |  0.41  |  2.4 | 656.08     | 511.21  
linalg/lq (5)             |   42.47  |  0.56  |  1.3 | 1169.18    | 493.13  
linalg/triangular (3)     |  219.56  |  5.65  |  2.6 | 8750.68    | 602.85  
sparse/sparse (4)         |   76.68  | 21.97  | 28.6 | 1766.83    | 579.08  
sparse/umfpack (4)        |    6.45  |  0.10  |  1.6 | 138.58     | 579.08  
sparse/cholmod (4)        |   14.67  |  0.35  |  2.4 | 361.11     | 579.67  
sparse/spqr (4)           |    1.63  |  0.04  |  2.4 | 62.19      | 579.67  
strings/basic (4)         |    4.20  |  0.09  |  2.2 | 105.49     | 579.67  
...

I do however see a line WARNING: Skipping blas num threads tests due to unsupported blas version somewhere way below.

Initially, I also tried enabling USE_INTEL_MKL_FFT := 1 but failed. Haven't looked further into it since not using FFT myself.

See also #17946.