Skip to content

Commit

Permalink
Fix MKLDNN 1st compile failure issue (apache#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhuang415 authored and zheng-da committed Feb 5, 2018
1 parent 3c5b740 commit c4e33a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ endif

ifeq ($(USE_MKLDNN), 1)
RETURN_STRING := $(shell ./prepare_mkldnn.sh $(MKLDNN_ROOT))
MKLDNNROOT := $(firstword $(RETURN_STRING))
LAST_WORD_INDEX := $(words $(RETURN_STRING))
# fetch the 2nd last word as MKLDNNROOT
MKLDNNROOT := $(word $(shell echo $$(($(LAST_WORD_INDEX) - 1))),$(RETURN_STRING))
MKLROOT := $(lastword $(RETURN_STRING))
export USE_MKLML = 1
endif
Expand Down
8 changes: 4 additions & 4 deletions prepare_mkldnn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ if [ ! -f "$MKLDNN_INSTALLDIR/lib/libmkldnn.so" ]; then
mkdir -p $MKLDNN_INSTALLDIR
cd $MKLDNN_ROOTDIR
if [ -z $MKLROOT ] && [ ! -f $MKLDNN_INSTALLDIR/include/mkl_cblas.h ]; then
rm -rf external && cd scripts && ./prepare_mkl.sh && cd ..
rm -rf external && cd scripts && ./prepare_mkl.sh >&2 && cd ..
cp -a external/*/* $MKLDNN_INSTALLDIR/.
fi
echo "Building MKLDNN ..." >&2
cd $MXNET_ROOTDIR
g++ --version >&2
if [ -z $ARCH_OPT ]; then
cmake $MKLDNN_ROOTDIR -DCMAKE_INSTALL_PREFIX=$MKLDNN_INSTALLDIR -B$MKLDNN_BUILDDIR
cmake $MKLDNN_ROOTDIR -DCMAKE_INSTALL_PREFIX=$MKLDNN_INSTALLDIR -B$MKLDNN_BUILDDIR >&2
else
cmake $MKLDNN_ROOTDIR -DCMAKE_INSTALL_PREFIX=$MKLDNN_INSTALLDIR -B$MKLDNN_BUILDDIR -DARCH_OPT_FLAGS=$ARCH_OPT
cmake $MKLDNN_ROOTDIR -DCMAKE_INSTALL_PREFIX=$MKLDNN_INSTALLDIR -B$MKLDNN_BUILDDIR -DARCH_OPT_FLAGS=$ARCH_OPT >&2
fi
make -C $MKLDNN_BUILDDIR -j$(cat /proc/cpuinfo | grep processor | wc -l) VERBOSE=1 >&2
make -C $MKLDNN_BUILDDIR install
make -C $MKLDNN_BUILDDIR install >&2
rm -rf $MKLDNN_BUILDDIR
mkdir -p $MKLDNN_LIBDIR
cp $MKLDNN_INSTALLDIR/lib/* $MKLDNN_LIBDIR
Expand Down

0 comments on commit c4e33a6

Please sign in to comment.