@@ -12,35 +12,40 @@ FindLibrary()
12
12
esac
13
13
14
14
}
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
+
15
28
# MKL
16
29
DST=` dirname $0 `
17
30
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 "
22
36
# there are diffrent MKL lib to be used for GCC and for ICC
23
- FindLibrary $1
24
37
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
36
44
# ...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
40
47
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
44
49
MKLROOT=$PWD /` echo $LOCALMKL | sed -e ' s/lib.*$//' `
45
50
fi
46
51
0 commit comments