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

Commit

Permalink
- Fix prepare_mkl for MKLGOLD
Browse files Browse the repository at this point in the history
- Makefile cleanup

- cosmetic changes

- Fix to interrupted binaries download

Desc:
When downloading of binaries is interrupted then
restarting the process will make binaries downloaded with diffrent name
and then first (broken) archive aws unpacked. This is now fixed by
fixing archive name
  • Loading branch information
jczaja committed Aug 30, 2016
1 parent 66cf31c commit 5a700a1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@ ifeq ($(MKL_EXTERNAL), 1)
MKL_LDFLAGS+=-Wl,-rpath,$(MKLROOT)/lib
endif

#$(info "RETURN_STRING: "$(RETURN_STRING))
#$(info "MKLROOT: "$(MKLROOT))

COMMON_FLAGS += -DUSE_MKL
BLAS_INCLUDE ?= $(MKLROOT)/include
BLAS_LIB ?= $(MKLROOT)/lib $(MKLROOT)/lib/intel64
Expand Down Expand Up @@ -558,7 +555,6 @@ ifeq ($(USE_OPENMP), 1)
endif
endif


# MPI support
ifeq ($(USE_MPI), 1)
COMMON_FLAGS += -DUSE_MPI
Expand Down
2 changes: 2 additions & 0 deletions Makefile.config.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

# Uncomment to use optimized MKL2017 primitives by default for supported layers
# USE_MKL2017_AS_DEFAULT_ENGINE := 1

# Uncomment to use MKLDNN primitives as default engine (EXPERIMENTAL)
# USE_MKLDNN_AS_DEFAULT_ENGINE := 1

# uncomment to disable IO dependencies and corresponding data layers
Expand Down
47 changes: 26 additions & 21 deletions external/mkl/prepare_mkl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,40 @@ FindLibrary()
esac

}

GetVersionName()
{
VERSION_LINE=0
if [ $1 ]; then
VERSION_LINE=`grep __INTEL_MKL_BUILD_DATE $1/include/mkl_version.h 2>/dev/null | sed -e 's/.* //'`
fi
if [ -z $VERSION_LINE ]; then
VERSION_LINE=0
fi
echo $VERSION_LINE # Return Version Line
}

# MKL
DST=`dirname $0`
OMP=0
MKLURL="https://github.com/intelcaffe/caffe/releases/download/self_containted_GOLD/mklml_lnx_2017.0.0.20160801.tgz "
if [ $MKLROOT ]; then
VERSION_LINE=`grep __INTEL_MKL_BUILD_DATE $MKLROOT/include/mkl_version.h 2>/dev/null | sed -e 's/.* //'`
fi
VERSION_MATCH=20160801
ARCHIVE_BASENAME=mklml_lnx_2017.0.0.$VERSION_MATCH.tgz
MKL_CONTENT_DIR=`echo $ARCHIVE_BASENAME | rev | cut -d "." -f 2- | rev`
GITHUB_RELEASE_TAG=self_containted_MKLGOLD
MKLURL="https://github.com/intel/caffe/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME"
# there are diffrent MKL lib to be used for GCC and for ICC
FindLibrary $1
reg='^[0-9]+$'
if [ -z $VERSION_LINE ]; then
VERSION_LINE=0
else
if ! [[ $VERSION_LINE =~ $reg ]]; then
VERSION_LINE=0
fi
fi
# Check if MKL_ROOT is set if positive then set one will be used..
VERSION_LINE=`GetVersionName $MKLROOT`
# Check if MKLROOT is set if positive then set one will be used..
if [ -z $MKLROOT ] || [ $VERSION_LINE -lt 20160706 ]; then
# ..if MKLROOT is not set then check if we have MKL downloaded..
if [ -z $LOCALMKL ] || [ ! -f $LOCALMKL ]; then
# ..if MKLROOT is not set then check if we have MKL downloaded in proper version
VERSION_LINE=`GetVersionName $DST/$MKL_CONTENT_DIR`
if [ $VERSION_LINE -lt 20160706 ] ; then
#...If it is not then downloaded and unpacked
wget --no-check-certificate -P $DST $MKLURL
tar -xzf $DST/mklml_lnx*.tgz -C $DST
FindLibrary $1
wget --no-check-certificate -P $DST $MKLURL -O $DST/$ARCHIVE_BASENAME
tar -xzf $DST/$ARCHIVE_BASENAME -C $DST
fi
# set MKL env vars are to be done via generated script
# this will help us export MKL env to existing shell

FindLibrary $1
MKLROOT=$PWD/`echo $LOCALMKL | sed -e 's/lib.*$//'`
fi

Expand Down

0 comments on commit 5a700a1

Please sign in to comment.