# Building with Intel MKL on a KNL system

**URL:** <https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904>\
**Category:** General Usage\
**Created:** [July 17, 2017, 2:53pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904 "2017-07-17T14:53:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![austinbean](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@austinbean](https://discourse.julialang.org/u/austinbean)\
**Post date:** [July 17, 2017, 2:53pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/1 "2017-07-17T14:53:48Z")

</div>

I’ve been trying to build 0.6 with Intel MKL on a Knights Landing [system](https://portal.tacc.utexas.edu/user-guides/stampede2). (I posted a question back in October about this too.) I wonder if anyone has done this successfully who might be able to share how they made it work.

My makefile contains:

```julia
LLVM_VER=4.0.0
USE_INTEL_MKL=1
USEICC=1
USEIFC=1
USE_INTEL_LIBM=1

```

I run  
`make -C deps get-llvm`  
first, but the build has always failed.  
I saved the entire output of the build process if that would be useful, but

```julia
make debug

```

returns the following:

```julia
[0%] Built target LLVMDemangle
[6%] Built target LLVMSupport
[6%] Built target LLVMTableGen
[9%] Built target obj.llvm-tblgen
[9%] Built target llvm-tblgen
[9%] Built target AttributeCompatFuncTableGen
[9%] Built target intrinsics_gen
[14%] Built target LLVMCore
[14%] Built target LLVMIRReader
[25%] Built target LLVMCodeGen
[29%] Built target LLVMSelectionDAG
[30%] Built target LLVMAsmPrinter
[30%] Built target LLVMMIRParser
[30%] Built target LLVMGlobalISel
[30%] Built target LLVMBitReader
[30%] Built target LLVMBitWriter
[35%] Built target LLVMTransformUtils
[35%] Built target LLVMInstrumentation
[37%] Built target LLVMInstCombine
[40%] Built target LLVMScalarOpts
[41%] Built target LLVMipo
[41%] Built target LLVMVectorize
[41%] Built target LLVMHello_exports
[41%] Built target LLVMHello
[43%] Built target LLVMObjCARCOpts
[43%] Built target LLVMCoroutines
[43%] Built target LLVMLinker
[50%] Built target LLVMAnalysis
[50%] Built target LLVMLTO
[54%] Built target LLVMMC
[56%] Built target LLVMMCParser
[56%] Built target LLVMMCDisassembler
[58%] Built target LLVMObject
[58%] Built target LLVMObjectYAML
[58%] Built target LLVMOption
[59%] Built target LLVMDebugInfoDWARF
[59%] Built target LLVMDebugInfoMSF
[61%] Built target LLVMDebugInfoCodeView
[66%] Built target LLVMDebugInfoPDB
[67%] Built target LLVMSymbolize
[69%] Built target LLVMExecutionEngine
[70%] Built target LLVMInterpreter
[70%] Built target LLVMMCJIT
[72%] Built target LLVMOrcJIT
[74%] Built target LLVMRuntimeDyld
[74%] Built target LLVMTarget
[74%] Built target NVPTXCommonTableGen
[75%] Built target LLVMNVPTXCodeGen
[75%] Built target LLVMNVPTXInfo
[75%] Built target LLVMNVPTXAsmPrinter
[75%] Built target LLVMNVPTXDesc
[75%] Built target X86CommonTableGen
[77%] Built target LLVMX86CodeGen
[77%] Built target LLVMX86AsmParser
[79%] Built target LLVMX86Disassembler
[80%] Built target LLVMX86AsmPrinter
[80%] Built target LLVMX86Desc
[80%] Built target LLVMX86Info
[80%] Built target LLVMX86Utils
[82%] Built target LLVMAsmParser
[82%] Built target LLVMLineEditor
[82%] Built target LLVMProfileData
[82%] Built target LLVMCoverage
[82%] Built target LLVMPasses
[82%] Built target LibOptionsTableGen
[82%] Built target LLVMLibDriver
[82%] Built target LLVMXRay
[82%] Built target FileCheck
[82%] Built target llvm-PerfectShuffle
[82%] Built target count
[82%] Built target not
[82%] Built target yaml-bench
[82%] Built target gtest
[82%] Built target gtest_main
[82%] Built target LLVM
[82%] Built target LTO_exports
[83%] Built target LTO
[83%] Linking CXX executable ../../bin/llvm-ar
/opt/apps/gcc/5.4.0/bin/ld: ../../bin/llvm-ar: hidden symbol `__intel_cpu_feature_indicator_x' in /opt/intel/compilers_and_libraries_2017.4.196/linux/compiler/lib/intel64_lin/libirc.a(cpu_feature_disp.o) is referenced by DSO
/opt/apps/gcc/5.4.0/bin/ld: final link failed: Bad value
make[4]: *** [bin/llvm-ar] Error 1
make[3]: *** [tools/llvm-ar/CMakeFiles/llvm-ar.dir/all] Error 2
make[2]: *** [all] Error 2
make[1]: *** [scratch/llvm-4.0.0/build_Release/build-compiled] Error 2
make: *** [julia-deps] Error 2

```

If anyone can point me in the right direction, or if I can provide a more useful set of error messages, that would be great. Thanks!

---

<div class="post-metadata">

**Author:** ![amellnik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amellnik/32/137_2.png) [@amellnik](https://discourse.julialang.org/u/amellnik)\
**Post date:** [July 17, 2017, 4:22pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/2 "2017-07-17T16:22:49Z")

</div>

Can you PM me your email address? I’ll reach out to someone in that group who may be able to help.

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [July 17, 2017, 6:39pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/3 "2017-07-17T18:39:25Z")

</div>

You should be able to build everything with gcc, but still keep MKL,  
i.e. remove the

> [@austinbean](#):
>
> USEICC=1  
> USEIFC=1

At some point the build worked with Intel compilers, but it’s never been particularly stable.

---

<div class="post-metadata">

**Author:** ![austinbean](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@austinbean](https://discourse.julialang.org/u/austinbean)\
**Post date:** [July 17, 2017, 8:03pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/4 "2017-07-17T20:03:47Z")

</div>

Thanks. That worked! I appreciate your help.

In case anyone else is trying to build on Stampede or Stampede 2 in the future, this is exactly what I did:

```julia
# This is on the login node
		git clone git://github.com/JuliaLang/julia.git
		cd julia
		git checkout v0.6.0
		vi Make.user
		# See contents below
		make -C deps get-llvm
		idev -m 60 # request time on compute node

# This is on the compute node
		source /opt/intel/compilers_and_libraries/linux/mkl/bin/mklvars.sh intel64
		module load cmake/3.7.1
		make -j 68 

```

The contents of `Make.user` :

```julia
LLVM_VER=4.0.0
USE_INTEL_MKL=1
USE_INTEL_LIBM=1

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [July 17, 2017, 9:10pm UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/5 "2017-07-17T21:10:50Z")

</div>

Did you ask support to add a Julia module? That would be nice to have on there.

---

<div class="post-metadata">

**Author:** ![austinbean](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@austinbean](https://discourse.julialang.org/u/austinbean)\
**Post date:** [July 18, 2017, 12:09am UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/6 "2017-07-18T00:09:17Z")

</div>

I will certainly email them. There are a few Julia users in my department who might be interested, at least.

---

<div class="post-metadata">

**Author:** ![mauriciogtec](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mauriciogtec](https://discourse.julialang.org/u/mauriciogtec)\
**Post date:** [September 13, 2018, 2:35am UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/7 "2018-09-13T02:35:50Z")

</div>

I am trying to follow these instructions, but getting the following error when running make:

```julia
WARNING: sha512 checksum for llvm-4.0.0.src.tar.xz not found in deps/checksums/, autogenerating...
can't find file to patch at input line 14
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From f23277bb91a4925ba8763337137a3123a7600557 Mon Sep 17 00:00:00 2001
|From: Valentin Churavy <v.churavy@gmail.com>
|Date: Tue, 16 Jan 2018 17:29:05 -0500
|Subject: [PATCH] add JL prefix to all LLVM version suffixes
|
|---
| tools/llvm-shlib/simple_version_script.map.in | 2 +-
| 1 file changed, 1 insertion(+), 1 deletion(-)
|
|diff --git a/tools/llvm-shlib/simple_version_script.map.in b/tools/llvm-shlib/simple_version_script.map.in
|index e9515fe7862..af082581627 100644
|--- a/tools/llvm-shlib/simple_version_script.map.in
|+++ b/tools/llvm-shlib/simple_version_script.map.in
--------------------------
File to patch: Skip this patch? [y] n
File to patch: n
n: No such file or directory
Skip this patch? [y] y
Skipping patch.
1 out of 1 hunk ignored
make[1]: *** [[...]/julia/deps/srccache/llvm-4.0.0/llvm-symver-jlprefix.patch-applied] Error 1
make: *** [julia-deps] Error 2

```

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [September 13, 2018, 2:40am UTC](https://discourse.julialang.org/t/building-with-intel-mkl-on-a-knl-system/4904/8 "2018-09-13T02:40:17Z")

</div>

The instructions are about a year outdated. Current master should work fine without special settings.
