[132814] trunk/dports/math
hum at macports.org
hum at macports.org
Wed Feb 11 00:12:20 PST 2015
Revision: 132814
https://trac.macports.org/changeset/132814
Author: hum at macports.org
Date: 2015-02-11 00:12:20 -0800 (Wed, 11 Feb 2015)
Log Message:
-----------
New port: caffe @ 20150131 - a fast framework for deep learning
Added Paths:
-----------
trunk/dports/math/caffe/
trunk/dports/math/caffe/Portfile
trunk/dports/math/caffe/files/
trunk/dports/math/caffe/files/patch-Makefile.conf.diff
trunk/dports/math/caffe/files/patch-Makefile.diff
trunk/dports/math/caffe/files/patch-openblas.diff
Added: trunk/dports/math/caffe/Portfile
===================================================================
--- trunk/dports/math/caffe/Portfile (rev 0)
+++ trunk/dports/math/caffe/Portfile 2015-02-11 08:12:20 UTC (rev 132814)
@@ -0,0 +1,108 @@
+# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem 1.0
+PortGroup github 1.0
+
+github.setup BVLC caffe e3c895baac64c7c2da4f30ab7ae35a1c84e63733
+version 20150131
+categories math science
+maintainers hum openmaintainer
+
+description a fast framework for deep learning (this port is for CPU-only)
+long_description ${description}
+
+homepage http://caffe.berkeleyvision.org/
+platforms darwin
+license BSD
+
+checksums rmd160 2ab530b22e986822dc6460193cd4f7cdfdceb47b \
+ sha256 6cd67cd280edc4ad934b51004cfc0285569b1d58f18d283c9f97cd493133e672
+
+depends_lib-append port:google-glog \
+ port:gflags \
+ port:protobuf-cpp \
+ port:leveldb \
+ port:snappy \
+ port:lmdb \
+ port:boost \
+ port:hdf5 \
+ port:opencv \
+ port:szip
+
+depends_run-append port:wget
+
+patchfiles patch-Makefile.diff \
+ patch-Makefile.conf.diff
+
+post-extract {
+ copy ${worksrcpath}/Makefile.config.example ${worksrcpath}/Makefile.config
+}
+
+use_configure no
+
+variant universal {}
+
+set defs "-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0"
+build.args CXX="${configure.cxx}" \
+ _CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx] ${defs}" \
+ _PREFIX=${prefix}
+
+set caffe_root ${prefix}/libexec/${name}
+
+destroot {
+ # copy files to caffe_root
+ xinstall -m 755 -d ${destroot}${caffe_root}
+ foreach dir {data examples models python scripts tools} {
+ copy ${worksrcpath}/${dir} ${destroot}${caffe_root}
+ }
+ copy ${worksrcpath}/.build_release ${destroot}${caffe_root}/build
+
+ # install additional documents
+ set docdir ${prefix}/share/doc/${name}
+ xinstall -m 755 -d ${destroot}${docdir}
+ xinstall -m 644 -W ${worksrcpath} \
+ CONTRIBUTORS.md LICENSE README.md \
+ ${destroot}${docdir}
+}
+
+notes "
+To try examples, copy ${caffe_root} and run commands.
+This port is for CPU-only. Do not forget to train on CPU, not on GPU.
+"
+
+default_variants +python27 +openblas
+
+variant openblas description {Use OpenBLAS} {
+ depends_lib-append port:OpenBLAS
+ patchfiles-append patch-openblas.diff
+}
+
+variant python27 description {Install Python 2.7 interface} {
+ depends_lib-append \
+ port:python27 \
+ port:py27-cython \
+ port:py27-numpy \
+ port:py27-scipy \
+ port:py27-scikit-image \
+ port:py27-scikit-learn \
+ port:py27-matplotlib \
+ port:py27-ipython \
+ port:py27-h5py \
+ port:py27-networkx \
+ port:py27-nose \
+ port:py27-pandas \
+ port:py27-protobuf \
+ port:py27-gflags \
+ port:py27-leveldb \
+ port:py27-dateutil
+
+ build.target-append pycaffe
+
+ post-destroot {
+ set packages_dir \
+ ${destroot}${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages
+ xinstall -m 755 -d ${packages_dir}
+ copy ${worksrcpath}/python/caffe ${packages_dir}
+ }
+}
Added: trunk/dports/math/caffe/files/patch-Makefile.conf.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-Makefile.conf.diff (rev 0)
+++ trunk/dports/math/caffe/files/patch-Makefile.conf.diff 2015-02-11 08:12:20 UTC (rev 132814)
@@ -0,0 +1,64 @@
+--- Makefile.config.orig 2014-12-18 01:12:23.000000000 +0900
++++ Makefile.config 2014-12-20 16:03:45.000000000 +0900
+@@ -5,26 +5,26 @@
+ # USE_CUDNN := 1
+
+ # CPU-only switch (uncomment to build without GPU support).
+-# CPU_ONLY := 1
++CPU_ONLY := 1
+
+ # To customize your choice of compiler, uncomment and set the following.
+ # N.B. the default for Linux is g++ and the default for OSX is clang++
+ # CUSTOM_CXX := g++
+
+ # CUDA directory contains bin/ and lib/ directories that we need.
+-CUDA_DIR := /usr/local/cuda
++# CUDA_DIR := /usr/local/cuda
+ # On Ubuntu 14.04, if cuda tools are installed via
+ # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
+ # CUDA_DIR := /usr
+
+ # CUDA architecture setting: going with all of them.
+ # For CUDA < 6.0, comment the *_50 lines for compatibility.
+-CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
+- -gencode arch=compute_20,code=sm_21 \
+- -gencode arch=compute_30,code=sm_30 \
+- -gencode arch=compute_35,code=sm_35 \
+- -gencode arch=compute_50,code=sm_50 \
+- -gencode arch=compute_50,code=compute_50
++# CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
++# -gencode arch=compute_20,code=sm_21 \
++# -gencode arch=compute_30,code=sm_30 \
++# -gencode arch=compute_35,code=sm_35 \
++# -gencode arch=compute_50,code=sm_50 \
++# -gencode arch=compute_50,code=compute_50
+
+ # BLAS choice:
+ # atlas for ATLAS (default)
+@@ -44,20 +44,21 @@
+
+ # 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_ROOT := $(_PREFIX)/Library/Frameworks/Python.framework/Versions/2.7
++PYTHON_INCLUDE := $(_PYTHON_ROOT)/include/python2.7 \
++ $(_PYTHON_ROOT)/lib/python2.7/site-packages/numpy/core/include
+ # Anaconda Python distribution is quite popular. Include path:
+ # PYTHON_INCLUDE := $(HOME)/anaconda/include \
+ # $(HOME)/anaconda/include/python2.7 \
+ # $(HOME)/anaconda/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 := $(_PREFIX)/lib
+ # PYTHON_LIB := $(HOME)/anaconda/lib
+
+ # Whatever else you find you need goes here.
+-INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+-LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
++INCLUDE_DIRS := $(PYTHON_INCLUDE) $(_PREFIX)/include /usr/include
++LIBRARY_DIRS := $(PYTHON_LIB) /usr/lib
+
+ BUILD_DIR := build
+ DISTRIBUTE_DIR := distribute
Added: trunk/dports/math/caffe/files/patch-Makefile.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-Makefile.diff (rev 0)
+++ trunk/dports/math/caffe/files/patch-Makefile.diff 2015-02-11 08:12:20 UTC (rev 132814)
@@ -0,0 +1,67 @@
+--- Makefile.orig 2014-12-06 01:12:55.000000000 +0900
++++ Makefile 2014-12-21 18:19:42.000000000 +0900
+@@ -167,10 +167,10 @@
+ endif
+ LIBRARIES += glog gflags protobuf leveldb snappy \
+ lmdb \
+- boost_system \
++ boost_system-mt \
+ hdf5_hl hdf5 \
+ opencv_core opencv_highgui opencv_imgproc pthread
+-PYTHON_LIBRARIES := boost_python python2.7
++PYTHON_LIBRARIES := boost_python-mt python2.7
+ WARNINGS := -Wall -Wno-sign-compare
+
+ ##############################
+@@ -239,13 +239,13 @@
+ # clang++ instead of g++
+ # libstdc++ instead of libc++ for CUDA compatibility on 10.9
+ ifeq ($(OSX), 1)
+- CXX := /usr/bin/clang++
++ CXX ?= /usr/bin/clang++
+ # clang throws this warning for cuda headers
+ WARNINGS += -Wno-unneeded-internal-declaration
+- ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
+- CXXFLAGS += -stdlib=libstdc++
+- LINKFLAGS += -stdlib=libstdc++
+- endif
++# ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
++# CXXFLAGS += -stdlib=libstdc++
++# LINKFLAGS += -stdlib=libstdc++
++# endif
+ # boost::thread is called boost_thread-mt to mark multithreading on OS X
+ LIBRARIES += boost_thread-mt
+ endif
+@@ -303,6 +303,14 @@
+ BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/
+ LIBRARIES += cblas
+ LDFLAGS += -framework vecLib
++ # fix for vecLib path on Xcode 6
++ XCODEVERSION := $(shell xcodebuild -version | head -1 | cut -f2 -d\ | cut -f1 -d.)
++ ifeq ($(shell echo $(XCODEVERSION) \>= 6 | bc), 1)
++ FRAMEWORKS_DIR = /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks
++ BLAS_INCLUDE = $(FRAMEWORKS_DIR)/vecLib.framework/Headers
++ LDFLAGS += -F$(FRAMEWORKS_DIR)
++ endif
++
+ endif
+ endif
+ INCLUDE_DIRS += $(BLAS_INCLUDE)
+@@ -310,7 +318,7 @@
+
+ # Complete build flags.
+ COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
+-CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
++CXXFLAGS += $(_CXXFLAGS) $(COMMON_FLAGS) $(WARNINGS)
+ NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
+ # mex may invoke an older gcc that is too liberal with -Wuninitalized
+ MATLAB_CXXFLAGS := $(CXXFLAGS) -Wno-uninitialized
+@@ -485,7 +493,7 @@
+ # Target for extension-less symlinks to tool binaries with extension '*.bin'.
+ $(TOOL_BUILD_DIR)/%: $(TOOL_BUILD_DIR)/%.bin | $(TOOL_BUILD_DIR)
+ @ $(RM) $@
+- @ ln -s $(abspath $<) $@
++ @ cd $(TOOL_BUILD_DIR); ln -s $(notdir $<) $(notdir $@)
+
+ $(TOOL_BINS): %.bin : %.o $(STATIC_NAME)
+ $(CXX) $< $(STATIC_NAME) -o $@ $(LINKFLAGS) $(LDFLAGS)
Added: trunk/dports/math/caffe/files/patch-openblas.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-openblas.diff (rev 0)
+++ trunk/dports/math/caffe/files/patch-openblas.diff 2015-02-11 08:12:20 UTC (rev 132814)
@@ -0,0 +1,22 @@
+--- Makefile.config.orig 2014-12-20 01:46:25.000000000 +0900
++++ Makefile.config 2014-12-21 19:00:59.000000000 +0900
+@@ -30,7 +30,7 @@
+ # atlas for ATLAS (default)
+ # mkl for MKL
+ # open for OpenBlas
+-BLAS := atlas
++BLAS := open
+ # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
+ # Leave commented to accept the defaults for your choice of BLAS
+ # (which should work)!
+--- include/caffe/util/mkl_alternate.hpp.orig 2014-12-18 01:12:23.000000000 +0900
++++ include/caffe/util/mkl_alternate.hpp 2014-12-21 18:59:58.000000000 +0900
+@@ -8,7 +8,7 @@
+ #else // If use MKL, simply include the MKL header
+
+ extern "C" {
+-#include <cblas.h>
++#include <cblas_openblas.h>
+ }
+ #include <math.h>
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150211/bc25fc74/attachment.html>
More information about the macports-changes
mailing list