Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 592de1f

Browse files
jczajaptbuilder
authored andcommitted
task-fix-preapre-mkl-4-new-repo: - Fix prepare_mkl for MKLGOLD
2 parents 66cf31c + 94b9001 commit 592de1f

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,6 @@ ifeq ($(MKL_EXTERNAL), 1)
434434
MKL_LDFLAGS+=-Wl,-rpath,$(MKLROOT)/lib
435435
endif
436436

437-
#$(info "RETURN_STRING: "$(RETURN_STRING))
438-
#$(info "MKLROOT: "$(MKLROOT))
439-
440437
COMMON_FLAGS += -DUSE_MKL
441438
BLAS_INCLUDE ?= $(MKLROOT)/include
442439
BLAS_LIB ?= $(MKLROOT)/lib $(MKLROOT)/lib/intel64
@@ -558,7 +555,6 @@ ifeq ($(USE_OPENMP), 1)
558555
endif
559556
endif
560557

561-
562558
# MPI support
563559
ifeq ($(USE_MPI), 1)
564560
COMMON_FLAGS += -DUSE_MPI

Makefile.config.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
# Uncomment to use optimized MKL2017 primitives by default for supported layers
1111
# USE_MKL2017_AS_DEFAULT_ENGINE := 1
12+
13+
# Uncomment to use MKLDNN primitives as default engine (EXPERIMENTAL)
1214
# USE_MKLDNN_AS_DEFAULT_ENGINE := 1
1315

1416
# uncomment to disable IO dependencies and corresponding data layers

external/mkl/prepare_mkl.sh

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,40 @@ FindLibrary()
1212
esac
1313

1414
}
15+
16+
GetVersionName()
17+
{
18+
VERSION_LINE=0
19+
if [ $1 ]; then
20+
VERSION_LINE=`grep __INTEL_MKL_BUILD_DATE $1/include/mkl_version.h 2>/dev/null | sed -e 's/.* //'`
21+
fi
22+
if [ -z $VERSION_LINE ]; then
23+
VERSION_LINE=0
24+
fi
25+
echo $VERSION_LINE # Return Version Line
26+
}
27+
1528
# MKL
1629
DST=`dirname $0`
1730
OMP=0
18-
MKLURL="https://github.com/intelcaffe/caffe/releases/download/self_containted_GOLD/mklml_lnx_2017.0.0.20160801.tgz "
19-
if [ $MKLROOT ]; then
20-
VERSION_LINE=`grep __INTEL_MKL_BUILD_DATE $MKLROOT/include/mkl_version.h 2>/dev/null | sed -e 's/.* //'`
21-
fi
31+
VERSION_MATCH=20160706
32+
ARCHIVE_BASENAME=mklml_lnx_2017.0.0.20160801.tgz
33+
MKL_CONTENT_DIR=`echo $ARCHIVE_BASENAME | rev | cut -d "." -f 2- | rev`
34+
GITHUB_RELEASE_TAG=self_containted_MKLGOLD
35+
MKLURL="https://github.com/intel/caffe/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME"
2236
# there are diffrent MKL lib to be used for GCC and for ICC
23-
FindLibrary $1
2437
reg='^[0-9]+$'
25-
if [ -z $VERSION_LINE ]; then
26-
VERSION_LINE=0
27-
else
28-
if ! [[ $VERSION_LINE =~ $reg ]]; then
29-
VERSION_LINE=0
30-
fi
31-
fi
32-
# Check if MKL_ROOT is set if positive then set one will be used..
33-
if [ -z $MKLROOT ] || [ $VERSION_LINE -lt 20160706 ]; then
34-
# ..if MKLROOT is not set then check if we have MKL downloaded..
35-
if [ -z $LOCALMKL ] || [ ! -f $LOCALMKL ]; then
38+
VERSION_LINE=`GetVersionName $MKLROOT`
39+
# Check if MKLROOT is set if positive then set one will be used..
40+
if [ -z $MKLROOT ] || [ $VERSION_LINE -lt $VERSION_MATCH ]; then
41+
# ..if MKLROOT is not set then check if we have MKL downloaded in proper version
42+
VERSION_LINE=`GetVersionName $DST/$MKL_CONTENT_DIR`
43+
if [ $VERSION_LINE -lt $VERSION_MATCH ] ; then
3644
#...If it is not then downloaded and unpacked
37-
wget --no-check-certificate -P $DST $MKLURL
38-
tar -xzf $DST/mklml_lnx*.tgz -C $DST
39-
FindLibrary $1
45+
wget --no-check-certificate -P $DST $MKLURL -O $DST/$ARCHIVE_BASENAME
46+
tar -xzf $DST/$ARCHIVE_BASENAME -C $DST
4047
fi
41-
# set MKL env vars are to be done via generated script
42-
# this will help us export MKL env to existing shell
43-
48+
FindLibrary $1
4449
MKLROOT=$PWD/`echo $LOCALMKL | sed -e 's/lib.*$//'`
4550
fi
4651

0 commit comments

Comments
 (0)