[133150] trunk/dports/math/caffe

hum at macports.org hum at macports.org
Sat Feb 21 23:00:03 PST 2015


Revision: 133150
          https://trac.macports.org/changeset/133150
Author:   hum at macports.org
Date:     2015-02-21 23:00:03 -0800 (Sat, 21 Feb 2015)
Log Message:
-----------
caffe: update to 20150221; add +gpu, +cudnn variants

Modified Paths:
--------------
    trunk/dports/math/caffe/Portfile
    trunk/dports/math/caffe/files/patch-Makefile.diff

Added Paths:
-----------
    trunk/dports/math/caffe/files/patch-Makefile.config.diff
    trunk/dports/math/caffe/files/patch-cpu-only.diff
    trunk/dports/math/caffe/files/patch-cudnn.diff

Removed Paths:
-------------
    trunk/dports/math/caffe/files/patch-Makefile.conf.diff

Modified: trunk/dports/math/caffe/Portfile
===================================================================
--- trunk/dports/math/caffe/Portfile	2015-02-22 05:54:58 UTC (rev 133149)
+++ trunk/dports/math/caffe/Portfile	2015-02-22 07:00:03 UTC (rev 133150)
@@ -4,20 +4,20 @@
 PortSystem          1.0
 PortGroup           github 1.0
 
-github.setup        BVLC caffe e3c895baac64c7c2da4f30ab7ae35a1c84e63733
-version             20150131
+github.setup        BVLC caffe 682d9da0dba98788dd01723a16a257df4382376c
+version             20150221
 categories          math science
 maintainers         hum openmaintainer
 
-description         a fast framework for deep learning (this port is for CPU-only)
+description         a fast framework for deep learning
 long_description    ${description}
 
 homepage            http://caffe.berkeleyvision.org/
 platforms           darwin
 license             BSD
 
-checksums           rmd160  2ab530b22e986822dc6460193cd4f7cdfdceb47b \
-                    sha256  6cd67cd280edc4ad934b51004cfc0285569b1d58f18d283c9f97cd493133e672
+checksums           rmd160  f8f7ae76ad25ba9fa4fe5f48bf9e7f35ebeda265 \
+                    sha256  e6c1fc9fe0092e3a2f2df1b3092d6641cae1edde9cd0e00144d490623873cc9b
 
 depends_lib-append  port:google-glog \
                     port:gflags \
@@ -33,7 +33,7 @@
 depends_run-append  port:wget
 
 patchfiles          patch-Makefile.diff \
-                    patch-Makefile.conf.diff
+                    patch-Makefile.config.diff
 
 post-extract {
     copy ${worksrcpath}/Makefile.config.example ${worksrcpath}/Makefile.config
@@ -68,11 +68,27 @@
 
 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.
 "
 
+if {[variant_isset cudnn]} { default_variants +gpu }
+
+if {![variant_isset gpu]} { default_variants +cpu }
+
 default_variants    +python27 +openblas
 
+variant cpu conflicts gpu description {Use CPU only} {
+    patchfiles-append  patch-cpu-only.diff
+    notes-append "
+This port is for CPU-only. Do not forget to train on CPU, not on GPU.
+"
+}
+
+variant gpu conflicts cpu description {Use GPU and CUDA in /usr/local/cuda} {}
+
+variant cudnn description {Use cuDNN} {
+    patchfiles-append  patch-cudnn.diff
+}
+
 variant openblas description {Use OpenBLAS} {
     depends_lib-append port:OpenBLAS
     patchfiles-append  patch-openblas.diff

Deleted: trunk/dports/math/caffe/files/patch-Makefile.conf.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-Makefile.conf.diff	2015-02-22 05:54:58 UTC (rev 133149)
+++ trunk/dports/math/caffe/files/patch-Makefile.conf.diff	2015-02-22 07:00:03 UTC (rev 133150)
@@ -1,64 +0,0 @@
---- 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.config.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-Makefile.config.diff	                        (rev 0)
+++ trunk/dports/math/caffe/files/patch-Makefile.config.diff	2015-02-22 07:00:03 UTC (rev 133150)
@@ -0,0 +1,33 @@
+--- Makefile.config.orig	2015-02-21 05:20:23.000000000 +0900
++++ Makefile.config	2015-02-22 14:36:58.000000000 +0900
+@@ -44,8 +44,9 @@
+ 
+ # 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:
+ # Verify anaconda location, sometimes it's in root.
+ # ANACONDA_HOME := $(HOME)/anaconda
+@@ -54,15 +55,15 @@
+ 		# $(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 := $(_PREFIX)/lib
+ # PYTHON_LIB := $(ANACONDA_HOME)/lib
+ 
+ # Uncomment to support layers written in Python (will link against Python libs)
+ # WITH_PYTHON_LAYER := 1
+ 
+ # 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
+ 
+ # Uncomment to use `pkg-config` to specify OpenCV library paths.
+ # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)

Modified: trunk/dports/math/caffe/files/patch-Makefile.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-Makefile.diff	2015-02-22 05:54:58 UTC (rev 133149)
+++ trunk/dports/math/caffe/files/patch-Makefile.diff	2015-02-22 07:00:03 UTC (rev 133150)
@@ -1,53 +1,37 @@
---- Makefile.orig	2014-12-06 01:12:55.000000000 +0900
-+++ Makefile	2014-12-21 18:19:42.000000000 +0900
-@@ -167,10 +167,10 @@
+--- Makefile.orig	2015-02-21 05:20:23.000000000 +0900
++++ Makefile	2015-02-22 14:29:16.000000000 +0900
+@@ -162,9 +162,9 @@
+ 	LIBRARIES := cudart cublas curand
  endif
  LIBRARIES += glog gflags protobuf leveldb snappy \
- 	lmdb \
--	boost_system \
-+	boost_system-mt \
- 	hdf5_hl hdf5 \
- 	opencv_core opencv_highgui opencv_imgproc pthread
+-	lmdb boost_system hdf5_hl hdf5 m \
++	lmdb boost_system-mt hdf5_hl hdf5 m \
+ 	opencv_core opencv_highgui opencv_imgproc
 -PYTHON_LIBRARIES := boost_python python2.7
 +PYTHON_LIBRARIES := boost_python-mt python2.7
  WARNINGS := -Wall -Wno-sign-compare
  
  ##############################
-@@ -239,13 +239,13 @@
+@@ -231,12 +231,12 @@
  # clang++ instead of g++
- # libstdc++ instead of libc++ for CUDA compatibility on 10.9
+ # libstdc++ for NVCC compatibility on OS X >= 10.9 with CUDA < 7.0
  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)),)
+-	CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release \d' | grep -o '\d')
+-	ifeq ($(shell echo $(CUDA_VERSION) \< 7.0 | bc), 1)
 -		CXXFLAGS += -stdlib=libstdc++
 -		LINKFLAGS += -stdlib=libstdc++
 -	endif
-+#	ifneq ($(findstring 10.9, $(shell sw_vers -productVersion)),)
++	CXX ?= /usr/bin/clang++
++#	CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release \d' | grep -o '\d')
++#	ifeq ($(shell echo $(CUDA_VERSION) \< 7.0 | bc), 1)
 +#		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 @@
+ 	# clang throws this warning for cuda headers
+ 	WARNINGS += -Wno-unneeded-internal-declaration
+ 	# gtest needs to use its own tuple to not conflict with clang
+@@ -337,7 +337,7 @@
  
  # Complete build flags.
  COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
@@ -56,12 +40,12 @@
  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 @@
+@@ -535,7 +535,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)
+ $(TOOL_BINS): %.bin : %.o | $(DYNAMIC_NAME)
+ 	@ echo CXX/LD -o $@

Added: trunk/dports/math/caffe/files/patch-cpu-only.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-cpu-only.diff	                        (rev 0)
+++ trunk/dports/math/caffe/files/patch-cpu-only.diff	2015-02-22 07:00:03 UTC (rev 133150)
@@ -0,0 +1,37 @@
+--- 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)

Added: trunk/dports/math/caffe/files/patch-cudnn.diff
===================================================================
--- trunk/dports/math/caffe/files/patch-cudnn.diff	                        (rev 0)
+++ trunk/dports/math/caffe/files/patch-cudnn.diff	2015-02-22 07:00:03 UTC (rev 133150)
@@ -0,0 +1,11 @@
+--- Makefile.config.orig	2015-02-22 14:13:41.000000000 +0900
++++ Makefile.config	2015-02-22 14:15:21.000000000 +0900
+@@ -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150221/43ec12c8/attachment-0001.html>


More information about the macports-changes mailing list