Skip to content

Instantly share code, notes, and snippets.

@robertsdionne
Last active February 15, 2021 16:07
Show Gist options
  • Save robertsdionne/f58a5fc6e5d1d5d2f798 to your computer and use it in GitHub Desktop.
Save robertsdionne/f58a5fc6e5d1d5d2f798 to your computer and use it in GitHub Desktop.

Revisions

  1. robertsdionne revised this gist Jul 8, 2015. 1 changed file with 60 additions and 56 deletions.
    116 changes: 60 additions & 56 deletions deepdream-install.md
    Original file line number Diff line number Diff line change
    @@ -54,69 +54,73 @@ pip install --requirement python/requirements.txt
    cp Makefile.config.example Makefile.config

    ########## Make the following adjustments to Makefile.config:

    # diff --git a/Makefile.config b/../caffe/Makefile.config
    # index a873502..c6806c2 100644
    # --- a/Makefile.config
    # +++ b/../caffe/Makefile.config
    # @@ -2,7 +2,7 @@
    # # Contributions simplifying and improving our build system are welcome!
    ```
    ```diff
    diff --git a/Makefile.config b/../caffe/Makefile.config
    index a873502..c6806c2 100644
    --- a/Makefile.config
    +++ b/../caffe/Makefile.config
    @@ -2,7 +2,7 @@
    # Contributions simplifying and improving our build system are welcome!

    # # cuDNN acceleration switch (uncomment to build with cuDNN).
    # -# USE_CUDNN := 1
    # +# USE_CUDNN := 1 ########### Keep it like this to disable cuDNN
    # +USE_CUDNN := 1 ########### Make it like this to enable cuDNN
    # cuDNN acceleration switch (uncomment to build with cuDNN).
    -# USE_CUDNN := 1
    +# USE_CUDNN := 1 ########### Keep it like this to disable cuDNN
    +USE_CUDNN := 1 ########### Make it like this to enable cuDNN

    # # CPU-only switch (uncomment to build without GPU support).
    # # CPU_ONLY := 1
    # @@ -34,7 +34,7 @@ BLAS := atlas
    # # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
    # # Leave commented to accept the defaults for your choice of BLAS
    # # (which should work)!
    # -# BLAS_INCLUDE := /path/to/your/blas
    # +BLAS_INCLUDE := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers
    # # BLAS_LIB := /path/to/your/blas
    # CPU-only switch (uncomment to build without GPU support).
    # CPU_ONLY := 1
    @@ -34,7 +34,7 @@ BLAS := atlas
    # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
    # Leave commented to accept the defaults for your choice of BLAS
    # (which should work)!
    -# BLAS_INCLUDE := /path/to/your/blas
    +BLAS_INCLUDE := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers
    # BLAS_LIB := /path/to/your/blas

    # # Homebrew puts openblas in a directory that is not on the standard search path
    # @@ -48,8 +48,8 @@ BLAS := atlas
    # Homebrew puts openblas in a directory that is not on the standard search path
    @@ -48,8 +48,8 @@ BLAS := atlas

    # # NOTE: this is required only if you will compile the python interface.
    # # We need to be able to find Python.h and numpy/arrayobject.h.
    # -PYTHON_INCLUDE := /usr/include/python2.7 \
    # - /usr/lib/python2.7/dist-packages/numpy/core/include
    # +PYTHON_INCLUDE := /usr/local/lib/python2.7/site-packages/numpy/core/include/ \
    # + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/include/python2.7/
    # # Anaconda Python distribution is quite popular. Include path:
    # # Verify anaconda location, sometimes it's in root.
    # # ANACONDA_HOME := $(HOME)/anaconda
    # @@ -58,7 +58,9 @@ PYTHON_INCLUDE := /usr/include/python2.7 \
    # # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
    # NOTE: this is required only if you will compile the python interface.
    # We need to be able to find Python.h and numpy/arrayobject.h.
    -PYTHON_INCLUDE := /usr/include/python2.7 \
    - /usr/lib/python2.7/dist-packages/numpy/core/include
    +PYTHON_INCLUDE := /usr/local/lib/python2.7/site-packages/numpy/core/include/ \
    + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/include/python2.7/
    # Anaconda Python distribution is quite popular. Include path:
    # Verify anaconda location, sometimes it's in root.
    # ANACONDA_HOME := $(HOME)/anaconda
    @@ -58,7 +58,9 @@ PYTHON_INCLUDE := /usr/include/python2.7 \
    # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

    # # We need to be able to find libpythonX.X.so or .dylib.
    # -PYTHON_LIB := /usr/lib
    # +PYTHON_LIB := /usr/local/lib/python2.7 \
    # + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/ \
    # + /usr/local/lib/python2.7/site-packages/numpy/lib
    # # PYTHON_LIB := $(ANACONDA_HOME)/lib
    # We need to be able to find libpythonX.X.so or .dylib.
    -PYTHON_LIB := /usr/lib
    +PYTHON_LIB := /usr/local/lib/python2.7 \
    + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/ \
    + /usr/local/lib/python2.7/site-packages/numpy/lib
    # PYTHON_LIB := $(ANACONDA_HOME)/lib

    # # Homebrew installs numpy in a non standard path (keg only)

    # Homebrew installs numpy in a non standard path (keg only)
    ```
    ```bash
    ########## Make the following adjustments to Makefile:

    # diff --git a/Makefile b/../caffe/Makefile
    # index e4e66df..8babaf8 100644
    # --- a/Makefile
    # +++ b/../caffe/Makefile
    # @@ -335,7 +335,7 @@ else
    # LDFLAGS += -framework Accelerate
    # else
    # BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
    # - LDFLAGS += -framework vecLib
    # + LDFLAGS += -framework Accelerate
    # endif
    # endif
    # endif

    ```
    ```diff
    diff --git a/Makefile b/../caffe/Makefile
    index e4e66df..8babaf8 100644
    --- a/Makefile
    +++ b/../caffe/Makefile
    @@ -335,7 +335,7 @@ else
    LDFLAGS += -framework Accelerate
    else
    BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
    - LDFLAGS += -framework vecLib
    + LDFLAGS += -framework Accelerate
    endif
    endif
    endif
    ```
    ```bash
    # Build caffe
    make all -j8; make pycaffe -j8

  2. robertsdionne renamed this gist Jul 8, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions deepdream-install.bash → deepdream-install.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    ```bash
    #!/usr/bin/env bash

    # Assuming OS X Yosemite 10.10.4
    @@ -136,3 +137,4 @@ pip install numpy scipy scikit-image pillow ipython[notebook]

    # Start IPython Notebook and select dream.ipynb
    ipython notebook dream.ipynb
    ```
  3. robertsdionne revised this gist Jul 5, 2015. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,17 @@ brew install python pip
    # Install Cuda 7
    brew cask install cuda

    # Optionally install cuDNN from https://developer.nvidia.com/cudnn which requries
    # 1) Registering for an NVIDIA account, accepting an end-user-license-agreement
    # 2) Downloading and extracting a tar.gz archive
    # 3) Copying lib* files to /usr/local/cuda/lib and cudnn.h to /usr/local/cuda/include
    #
    # robertsdionne:~/$ ls /usr/local/cuda/lib/*dnn*
    # /usr/local/cuda/lib/libcudnn.6.5.dylib /usr/local/cuda/lib/libcudnn_static.a
    # /usr/local/cuda/lib/libcudnn.dylib
    # robertsdionne:~/$ ls /usr/local/cuda/include/*dnn*
    # /usr/local/cuda/include/cudnn.h

    # Install dependencies; see http://caffe.berkeleyvision.org/install_osx.html
    brew install --fresh -vd snappy leveldb gflags glog szip lmdb
    # need the homebrew science source for OpenCV and hdf5
    @@ -52,7 +63,8 @@ cp Makefile.config.example Makefile.config

    # # cuDNN acceleration switch (uncomment to build with cuDNN).
    # -# USE_CUDNN := 1
    # +# USE_CUDNN := 1
    # +# USE_CUDNN := 1 ########### Keep it like this to disable cuDNN
    # +USE_CUDNN := 1 ########### Make it like this to enable cuDNN

    # # CPU-only switch (uncomment to build without GPU support).
    # # CPU_ONLY := 1
  4. robertsdionne revised this gist Jul 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -52,7 +52,7 @@ cp Makefile.config.example Makefile.config

    # # cuDNN acceleration switch (uncomment to build with cuDNN).
    # -# USE_CUDNN := 1
    # +USE_CUDNN := 1
    # +# USE_CUDNN := 1

    # # CPU-only switch (uncomment to build without GPU support).
    # # CPU_ONLY := 1
  5. robertsdionne revised this gist Jul 5, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -82,7 +82,7 @@ cp Makefile.config.example Makefile.config
    # # We need to be able to find libpythonX.X.so or .dylib.
    # -PYTHON_LIB := /usr/lib
    # +PYTHON_LIB := /usr/local/lib/python2.7 \
    # + //usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/ \
    # + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/ \
    # + /usr/local/lib/python2.7/site-packages/numpy/lib
    # # PYTHON_LIB := $(ANACONDA_HOME)/lib

  6. robertsdionne revised this gist Jul 5, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,9 @@ xcode-select --install
    # Install the Homebrew package manager if you don't already use it; see source http://brew.sh
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    # Install homebrew cask
    brew install caskroom/cask/brew-cask

    # Install Python 2.7 and pip
    brew install python pip

  7. robertsdionne revised this gist Jul 3, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -119,5 +119,5 @@ cd deepdream
    # Install python requirements
    pip install numpy scipy scikit-image pillow ipython[notebook]

    # Start IPython Notebook
    ipython notebook
    # Start IPython Notebook and select dream.ipynb
    ipython notebook dream.ipynb
  8. robertsdionne revised this gist Jul 3, 2015. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions deepdream-install.bash
    Original file line number Diff line number Diff line change
    @@ -110,3 +110,14 @@ make distribute
    # Set your environment variables for success
    export PYTHONPATH="$HOME/caffe/distribute/python:$PYTHONPATH"
    export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:$HOME/caffe/distribute/lib:$DYLD_FALLBACK_LIBRARY_PATH

    # Clone deepdream
    cd ..
    git clone https://github.com/google/deepdream.git
    cd deepdream

    # Install python requirements
    pip install numpy scipy scikit-image pillow ipython[notebook]

    # Start IPython Notebook
    ipython notebook
  9. robertsdionne renamed this gist Jul 3, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. robertsdionne revised this gist Jul 3, 2015. 1 changed file with 72 additions and 7 deletions.
    79 changes: 72 additions & 7 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -28,20 +28,85 @@ brew install --build-from-source --fresh -vd \
    https://raw.githubusercontent.com/Homebrew/homebrew/6fd6a9b6b2f56139a44dd689d30b7168ac13effb/Library/Formula/boost.rb \
    https://raw.githubusercontent.com/Homebrew/homebrew/3141234b3473717e87f3958d4916fe0ada0baba9/Library/Formula/boost-python.rb

    # Set your environment variables for success
    export PYTHONPATH="$HOME/Code/caffe/distribute/python:$PYTHONPATH"
    export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/Users/robertsdionne/Code/caffe/distribute/lib:$DYLD_FALLBACK_LIBRARY_PATH

    # Clone caffe
    git clone https://github.com/BVLC/caffe.git
    cd caffe

    # Install python dependencies
    pip install --requirement python/requirements.txt

    # Adjust Makefile.config
    cp Makefile.config.example Makefile.config

    ########## Make the following adjustments to Makefile.config:

    # diff --git a/Makefile.config b/../caffe/Makefile.config
    # index a873502..c6806c2 100644
    # --- a/Makefile.config
    # +++ b/../caffe/Makefile.config
    # @@ -2,7 +2,7 @@
    # # Contributions simplifying and improving our build system are welcome!

    # # cuDNN acceleration switch (uncomment to build with cuDNN).
    # -# USE_CUDNN := 1
    # +USE_CUDNN := 1

    # # CPU-only switch (uncomment to build without GPU support).
    # # CPU_ONLY := 1
    # @@ -34,7 +34,7 @@ BLAS := atlas
    # # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
    # # Leave commented to accept the defaults for your choice of BLAS
    # # (which should work)!
    # -# BLAS_INCLUDE := /path/to/your/blas
    # +BLAS_INCLUDE := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers
    # # BLAS_LIB := /path/to/your/blas

    # # Homebrew puts openblas in a directory that is not on the standard search path
    # @@ -48,8 +48,8 @@ BLAS := atlas

    # # NOTE: this is required only if you will compile the python interface.
    # # We need to be able to find Python.h and numpy/arrayobject.h.
    # -PYTHON_INCLUDE := /usr/include/python2.7 \
    # - /usr/lib/python2.7/dist-packages/numpy/core/include
    # +PYTHON_INCLUDE := /usr/local/lib/python2.7/site-packages/numpy/core/include/ \
    # + /usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/include/python2.7/
    # # Anaconda Python distribution is quite popular. Include path:
    # # Verify anaconda location, sometimes it's in root.
    # # ANACONDA_HOME := $(HOME)/anaconda
    # @@ -58,7 +58,9 @@ PYTHON_INCLUDE := /usr/include/python2.7 \
    # # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

    # # We need to be able to find libpythonX.X.so or .dylib.
    # -PYTHON_LIB := /usr/lib
    # +PYTHON_LIB := /usr/local/lib/python2.7 \
    # + //usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/ \
    # + /usr/local/lib/python2.7/site-packages/numpy/lib
    # # PYTHON_LIB := $(ANACONDA_HOME)/lib

    # # Homebrew installs numpy in a non standard path (keg only)

    ########## Make the following adjustments to Makefile:

    # diff --git a/Makefile b/../caffe/Makefile
    # index e4e66df..8babaf8 100644
    # --- a/Makefile
    # +++ b/../caffe/Makefile
    # @@ -335,7 +335,7 @@ else
    # LDFLAGS += -framework Accelerate
    # else
    # BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
    # - LDFLAGS += -framework vecLib
    # + LDFLAGS += -framework Accelerate
    # endif
    # endif
    # endif

    make all
    make test
    make runtest
    # Build caffe
    make all -j8; make pycaffe -j8

    # Package caffe
    make distribute

    # Set your environment variables for success
    export PYTHONPATH="$HOME/caffe/distribute/python:$PYTHONPATH"
    export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:$HOME/caffe/distribute/lib:$DYLD_FALLBACK_LIBRARY_PATH
  11. robertsdionne created this gist Jul 3, 2015.
    47 changes: 47 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    #!/usr/bin/env bash

    # Assuming OS X Yosemite 10.10.4

    # Install XCode and command line tools
    # See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
    # See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
    xcode-select --install

    # Install the Homebrew package manager if you don't already use it; see source http://brew.sh
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    # Install Python 2.7 and pip
    brew install python pip

    # Install Cuda 7
    brew cask install cuda

    # Install dependencies; see http://caffe.berkeleyvision.org/install_osx.html
    brew install --fresh -vd snappy leveldb gflags glog szip lmdb
    # need the homebrew science source for OpenCV and hdf5
    brew tap homebrew/science
    brew install hdf5 opencv
    # with Python pycaffe needs dependencies built from source
    brew install --build-from-source --with-python --fresh -vd protobuf
    # We need boost{,-python}-1.57.0 due to a bug in 1.58.0 on Yosemite 10.10.4
    brew install --build-from-source --fresh -vd \
    https://raw.githubusercontent.com/Homebrew/homebrew/6fd6a9b6b2f56139a44dd689d30b7168ac13effb/Library/Formula/boost.rb \
    https://raw.githubusercontent.com/Homebrew/homebrew/3141234b3473717e87f3958d4916fe0ada0baba9/Library/Formula/boost-python.rb

    # Set your environment variables for success
    export PYTHONPATH="$HOME/Code/caffe/distribute/python:$PYTHONPATH"
    export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/Users/robertsdionne/Code/caffe/distribute/lib:$DYLD_FALLBACK_LIBRARY_PATH

    # Clone caffe
    git clone https://github.com/BVLC/caffe.git
    cd caffe


    # Adjust Makefile.config
    cp Makefile.config.example Makefile.config



    make all
    make test
    make runtest