[caffe-contrib] 87/362: d/rules: try to build caffe-cuda

Zhou Mo cdluminate-guest at moszumanska.debian.org
Tue May 3 09:24:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

cdluminate-guest pushed a commit to branch master
in repository caffe-contrib.

commit 3541fa71f8c4cf6f5ef566e6ed8ec240f471a9ac
Author: Zhou Mo <cdluminate at gmail.com>
Date:   Thu Aug 13 10:02:45 2015 +0000

    d/rules: try to build caffe-cuda
---
 debian/rules | 72 +++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/debian/rules b/debian/rules
index 91b8048..7ff0abe 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,23 +4,34 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
 RULES  := debian/rules
+
 export CAFFE_CPU_BUILDDIR="caffe_cpu_build"
-#export CAFFE_CUDA_BUILDDIR="caffe_cuda_build"
+export CAFFE_CUDA_BUILDDIR="caffe_cuda_build"
+
+ifeq (amd64, $(DEB_HOST_ARCH))
+	flag_build_caffe_cuda := y
+endif
+ifeq (i386, $(DEB_HOST_ARCH))
+	flag_build_caffe_cuda := y
+endif
 
 %:
 	dh $@ --parallel \
 	      --buildsystem=cmake \
 		  --builddirectory=${CAFFE_CPU_BUILDDIR}
-
-#%:
-#  dh $@ --parallel \
-#        --buildsystem=cmake \
-#        --builddirectory=${CAFFE_CUDA_BUILDDIR}
+ifeq (y,$(flag_build_caffe_cuda))
+		dh $@ --parallel \
+			  --buildsystem=cmake \
+			  --builddirectory=${CAFFE_CUDA_BUILDDIR}
+endif
 
 override_dh_auto_configure:
-	# This configure is for CPU only caffe
-	dh_auto_configure -- \
+	-mkdir $(CAFFE_CPU_BUILDDIR)
+	dh_auto_configure \
+		--builddirectory=${CAFFE_CPU_BUILDDIR} \
+		-- \
 		-DBLAS="Open" \
 		-DCMAKE_SKIP_RPATH=TRUE \
 		-DCPU_ONLY=ON \
@@ -31,27 +42,29 @@ override_dh_auto_configure:
 		-DBUILD_matlab=OFF \
 		-DBUILD_docs=ON \
 		-DBUILD_python_layer=ON
-
-#	This configure is for CUDA caffe
-#	dh_auto_configure -- \
-#		-DBLAS="Open" \
-#		-DCMAKE_SKIP_RPATH=TRUE \
-#		-DCPU_ONLY=OFF \
-#		-DUSE_CUDNN=OFF \
-#		-DBUILD_SHARED_LIBS=ON \
-#		-DBUILD_python=ON \
-#		-Dpython_version="2" \
-#		-DBUILD_matlab=OFF \
-#		-DBUILD_docs=ON \
-#		-DBUILD_python_layer=ON \
-#		-DCMAKE_CXX_COMPILER=g++-4.6 \
-#		-DCMAKE_C_COMPILER=gcc-4.6
-# XXX: see debian-science list Aug 2015 , thread:
-#      Re: [caffe] current status of packaging the deeplearning framework
+ifeq (y,$(flag_build_caffe_cuda))
+	-mkdir $(CAFFE_CUDA_BUILDDIR)
+	dh_auto_configure \
+		--builddirectory=${CAFFE_CUDA_BUILDDIR} \
+		-- \
+		-DBLAS="Open" \
+		-DCMAKE_SKIP_RPATH=TRUE \
+		-DCPU_ONLY=OFF \
+		-DUSE_CUDNN=OFF \
+		-DBUILD_SHARED_LIBS=ON \
+		-DBUILD_python=ON \
+		-Dpython_version="2" \
+		-DBUILD_matlab=OFF \
+		-DBUILD_docs=ON \
+		-DBUILD_python_layer=ON \
+		-DCMAKE_CXX_COMPILER=g++-4.6 \
+		-DCMAKE_C_COMPILER=gcc-4.6
+endif	
 
 override_dh_auto_clean:
 	dh_testdir
-	-$(RM) -rf ${CAFFE_CPU_BUILDDIR}  python/caffe/proto/
+	-$(RM) -rf ${CAFFE_CPU_BUILDDIR} ${CAFFE_CUDA_BUILDDIR} \
+		python/caffe/proto/
 	-$(RM) python/caffe/_caffe.so
 
 # In the test phase, we need to set LD_LIBRARY_PATH properly
@@ -61,8 +74,11 @@ override_dh_auto_test:
 	dh_auto_test -- test # compile test excutables 
 	dh_auto_test -- runtest LD_LIBRARY_PATH=${CAFFE_CPU_BUILDDIR}/lib/ 
 
-#override_dh_shlibdeps:
-#	dh_shlibdeps -- -ldebian/libcaffe-cpu0/usr/lib
+override_dh_auto_install:
+	dh_auto_install -- -pcaffe-cpu -plibcaffe-cpu0 -plibcaffe-cpu-dev
+ifeq (y, $(flag_build_caffe_cuda))
+	dh_auto_install -- -pcaffe-cuda -plibcaffe-cuda0 -plibcaffe-cuda-dev
+endif
 
 # Since the Distributed Binary Caffe can not play the best performance
 # of user's machines, it's good to provide a custom build target,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/caffe-contrib.git



More information about the debian-science-commits mailing list