summaryrefslogtreecommitdiff
path: root/conda
diff options
context:
space:
mode:
authorJesse Hellemn <hellemn@fb.com>2018-01-03 16:52:50 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-01-03 17:14:27 -0800
commitf90feac38bd1d9c178cf345f4f0ceba7f13e1987 (patch)
tree7088cfa11588248882fc9a4ada9b55a0008e265c /conda
parent9835ca9bac135352cd356e5f87f832dcbbc6d1fa (diff)
downloadpytorch-f90feac38bd1d9c178cf345f4f0ceba7f13e1987.tar.gz
pytorch-f90feac38bd1d9c178cf345f4f0ceba7f13e1987.tar.bz2
pytorch-f90feac38bd1d9c178cf345f4f0ceba7f13e1987.zip
Adding conda specific script to macos builds
Summary: Closes https://github.com/caffe2/caffe2/pull/1640 Reviewed By: pietern Differential Revision: D6624013 Pulled By: pjh5 fbshipit-source-id: 0e980f020bce7bca1cb0845114a6071a004443af
Diffstat (limited to 'conda')
-rwxr-xr-x[-rw-r--r--]conda/build.sh53
-rw-r--r--conda/meta.yaml13
2 files changed, 55 insertions, 11 deletions
diff --git a/conda/build.sh b/conda/build.sh
index 4c5e901f9d..bc4023371f 100644..100755
--- a/conda/build.sh
+++ b/conda/build.sh
@@ -1,21 +1,66 @@
#!/bin/bash
-set -e
+# Install script for Anaconda environments on macOS. This will only work on mac
+# This script is not supposed to be called correctly, but should be run by:
+#
+# $ cd <path to caffe2, e.g. ~/caffe2>
+# $ conda build conda/build
+#
+# This installation uses MKL and does not use CUDA
+#
+# If you're debugging this, it may be useful to use the env that conda build is
+# using:
+# $ cd <anaconda_root>/conda-bld/caffe2_<timestamp>
+# $ source activate _h_env_... # some long path with lots of placeholders
+#
+# Also, failed builds will accumulate those caffe2_<timestamp> directories. You
+# can remove them after a succesfull build with
+# $ conda build purge
+
+set -ex
if [ -z "$PREFIX" ]; then
PREFIX="$CONDA_PREFIX"
fi
+echo "Installing caffe2 to ${PREFIX}"
# conda build will copy everything over, including build directories.
-# Don't let this pollute hte build!
+# Don't let this pollute the build!
rm -rf build || true
+# Default leveldb from conda-forge doesn't work. If you want to use leveldb,
+# use this old pip version
+# pip install leveldb==0.18
+
PYTHON_ARGS="$(python ./scripts/get_python_cmake_flags.py)"
+CMAKE_ARGS=()
+
+# This installation defaults to using MKL because it is much faster. If you
+# want to build without MKL then you should also remove mkl from meta.yaml in
+# addition to removing the flags below
+CMAKE_ARGS+=("-DBLAS=MKL")
+CMAKE_ARGS+=("-DMKL_INCLUDE_DIR=$CONDA_PREFIX/include")
+
+# The following libraries are incompatible with macOS builds
+CMAKE_ARGS+=("-DUSE_GLOO=OFF")
+CMAKE_ARGS+=("-DUSE_MOBILE_OPENGL=OFF")
+CMAKE_ARGS+=("-DUSE_METAL=OFF")
+
+# It is rare for macs to have a GPU card with CUDA support, but if you have one
+# then remove these flags
+CMAKE_ARGS+=("-DUSE_CUDA=OFF")
+CMAKE_ARGS+=("-DUSE_NCCL=OFF")
+
+# Install under specified prefix
+CMAKE_ARGS+=("-DCMAKE_INSTALL_PREFIX=$PREFIX")
+CMAKE_ARGS+=("-DCMAKE_PREFIX_PATH=$PREFIX")
+CMAKE_ARGS+=("-DUSE_LEVELDB=OFF")
+# Build. Note this assumes uname==Darwin as this script is meant for mac
mkdir -p build
cd build
-cmake -DBLAS=MKL -DMKL_INCLUDE_DIR=$CONDA_PREFIX/include -DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_PREFIX_PATH="$PREFIX" $CONDA_CMAKE_ARGS $PYTHON_ARGS ..
-make -j20
+cmake "${CMAKE_ARGS[@]}" $CONDA_CMAKE_ARGS $PYTHON_ARGS ..
+make VERBOSE=1 "-j$(sysctl -n hw.ncpu)"
make install/fast
diff --git a/conda/meta.yaml b/conda/meta.yaml
index b6150c9f1a..c5df32d25f 100644
--- a/conda/meta.yaml
+++ b/conda/meta.yaml
@@ -9,7 +9,7 @@ source:
build:
number: 1
- skip: True # [win]
+ skip: True # [win or py3k]
script_env:
- CONDA_CMAKE_ARGS
@@ -21,11 +21,10 @@ requirements:
- six
- eigen
- python
- - protobuf ==3.4.0
+ - protobuf
- cmake
- - leveldb
- lmdb
- - snappy
+ - snappy ==1.1.6
- mkl-include
- mkl
run:
@@ -35,11 +34,11 @@ requirements:
- six
- eigen
- python
- - protobuf ==3.4.0
- - leveldb
+ - protobuf
- lmdb
- - snappy
+ - snappy ==1.1.6
- future
+ - mkl-include
- mkl
about: