You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/14 20:28:26 UTC
[GitHub] szha commented on a change in pull request #10115: Compile MKLDNN in Mac.
szha commented on a change in pull request #10115: Compile MKLDNN in Mac.
URL: https://github.com/apache/incubator-mxnet/pull/10115#discussion_r174599630
##########
File path: prepare_mkldnn.sh
##########
@@ -84,7 +84,13 @@ if [ ! -f "$MKLDNN_INSTALLDIR/lib/libmkldnn.so" ]; then
cd $MXNET_ROOTDIR
g++ --version >&2
cmake $MKLDNN_ROOTDIR -DCMAKE_INSTALL_PREFIX=$MKLDNN_INSTALLDIR -B$MKLDNN_BUILDDIR -DARCH_OPT_FLAGS="-mtune=generic" >&2
- make -C $MKLDNN_BUILDDIR -j$(cat /proc/cpuinfo | grep processor | wc -l) VERBOSE=1 >&2
+ if [ $OSTYPE == "linux-gnu" ]; then
+ make -C $MKLDNN_BUILDDIR -j$(cat /proc/cpuinfo | grep processor | wc -l) VERBOSE=1 >&2
+ elif [ $OSTYPE == "darwin16" ]; then
+ make -C $MKLDNN_BUILDDIR -j$(sysctl -n hw.ncpu) VERBOSE=1 >&2
+ else
+ make -C $MKLDNN_BUILDDIR VERBOSE=1 >&2
+ fi
Review comment:
Maybe refactor the processor discovery to reduce duplicated make calls? I used this snippet for discovering number of processes elsewhere.
```bash
NUM_PROC=1
if [[ ! -z $(command -v nproc) ]]; then
NUM_PROC=$(nproc)
elif [[ ! -z $(command -v sysctl) ]]; then
NUM_PROC=$(sysctl -n hw.ncpu)
else
>&2 echo "Can't discover number of cores."
fi
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services