summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Bermond2020-07-25 16:07:06 +0000
committerDaniel Bermond2020-07-25 16:08:00 +0000
commit504c3616ef2b9819a15ac2775300c696a86fe064 (patch)
tree886ef532029788593c26073aa1d307bd7a722b39
parentdee6d8c58f9526488e0a68f8f42aa759f92070a5 (diff)
downloadaur-caffe-cuda.tar.gz
Adjust Makefile for cuda 11.0. Disable cudnn. Cosmetic changes.
cuda 11.0 minimum supported architecture is 5.2 (compute_52/sm_52). caffe currently fails to build with cudnn 8.0.
-rw-r--r--.SRCINFO7
-rw-r--r--Makefile.config12
-rw-r--r--PKGBUILD33
-rw-r--r--caffe-1.0-opencv4-fix.patch116
4 files changed, 20 insertions, 148 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 28e26f224ed..5ad7fe649f3 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = caffe-cuda
pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (with cuda support)
pkgver = 1.0
- pkgrel = 9
+ pkgrel = 10
url = https://caffe.berkeleyvision.org/
arch = x86_64
license = BSD
@@ -24,7 +24,6 @@ pkgbase = caffe-cuda
depends = python-numpy
depends = python-pandas
depends = cuda
- depends = cudnn
depends = nccl
optdepends = cython
optdepends = python-scipy
@@ -46,9 +45,9 @@ pkgbase = caffe-cuda
conflicts = caffe
source = caffe-1.0.tar.gz::https://github.com/BVLC/caffe/archive/1.0.tar.gz
source = Makefile.config
- source = caffe-1.0-opencv4-fix.patch
+ source = caffe-opencv4-fix.patch::https://github.com/BVLC/caffe/pull/6625/commits/7f503bd9a19758a173064e299ab9d4cac65ed60f.patch
sha256sums = 71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f
- sha256sums = eefbefb25d99e801066526eabd57ed11efd05d0f6e312e40cd030d3a13f06ed4
+ sha256sums = fa15c69970a6006512319944dc171e92b42b3eb0ea8d0e9e1fb9cf0e4833b04c
sha256sums = 2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9
pkgname = caffe-cuda
diff --git a/Makefile.config b/Makefile.config
index d4bf065c01a..c8a00aafbf2 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -2,19 +2,14 @@ _PYVER := $(shell python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')
_PYMAJ := $(shell python -c 'import sys; print("%s" %sys.version_info[0])')
_OCVMAJ := $(shell opencv_version | awk -F'.' '{ print $$1 }')
-USE_CUDNN := 1
+USE_CUDNN := 0
USE_OPENCV := 1
USE_LEVELDB := 1
USE_LMDB := 1
OPENCV_VERSION := $(_OCVMAJ)
CUSTOM_CXX := /opt/cuda/bin/g++
CUDA_DIR := /opt/cuda
-CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
- -gencode arch=compute_32,code=sm_32 \
- -gencode arch=compute_35,code=sm_35 \
- -gencode arch=compute_37,code=sm_37 \
- -gencode arch=compute_50,code=sm_50 \
- -gencode arch=compute_52,code=sm_52 \
+CUDA_ARCH := -gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_53,code=sm_53 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
@@ -22,7 +17,8 @@ CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_70,code=sm_70 \
-gencode arch=compute_72,code=sm_72 \
-gencode arch=compute_75,code=sm_75 \
- -gencode arch=compute_75,code=compute_75
+ -gencode arch=compute_80,code=sm_80 \
+ -gencode arch=compute_80,code=compute_80
BLAS := open
BLAS_INCLUDE := /usr/include
BLAS_LIB := /usr/lib
diff --git a/PKGBUILD b/PKGBUILD
index 45fe7f8dffc..5a0934609cc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,14 +2,14 @@
pkgname=caffe-cuda
pkgver=1.0
-pkgrel=9
+pkgrel=10
pkgdesc='A deep learning framework made with expression, speed, and modularity in mind (with cuda support)'
arch=('x86_64')
url='https://caffe.berkeleyvision.org/'
license=('BSD')
depends=('openblas' 'lapack' 'boost-libs' 'protobuf' 'google-glog' 'gflags'
'hdf5' 'opencv' 'leveldb' 'lmdb' 'python' 'python-numpy' 'python-pandas'
- 'cuda' 'cudnn' 'nccl')
+ 'cuda' 'nccl')
optdepends=(
# official repositories:
'cython' 'python-scipy' 'python-matplotlib' 'ipython' 'python-h5py'
@@ -26,17 +26,14 @@ provides=('caffe')
conflicts=('caffe')
source=("caffe-${pkgver}.tar.gz"::"https://github.com/BVLC/caffe/archive/${pkgver}.tar.gz"
'Makefile.config'
- 'caffe-1.0-opencv4-fix.patch')
+ 'caffe-opencv4-fix.patch'::'https://github.com/BVLC/caffe/pull/6625/commits/7f503bd9a19758a173064e299ab9d4cac65ed60f.patch')
sha256sums=('71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f'
- 'eefbefb25d99e801066526eabd57ed11efd05d0f6e312e40cd030d3a13f06ed4'
+ 'fa15c69970a6006512319944dc171e92b42b3eb0ea8d0e9e1fb9cf0e4833b04c'
'2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9')
prepare() {
cp -af Makefile.config "caffe-${pkgver}"
-
- # fix build with opencv 4
- # https://github.com/BVLC/caffe/pull/6625
- patch -d "caffe-${pkgver}" -Np1 -i "${srcdir}/caffe-1.0-opencv4-fix.patch"
+ patch -d "caffe-${pkgver}" -Np1 -i "${srcdir}/caffe-opencv4-fix.patch"
}
build() {
@@ -50,35 +47,31 @@ check() {
}
package() {
- cd "caffe-${pkgver}/distribute"
-
local _pyver
_pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
mkdir -p "$pkgdir"/usr/{bin,include,lib/python"$_pyver"/site-packages,share/doc}
# binaries
- install -m755 bin/* "${pkgdir}/usr/bin"
+ install -m755 "caffe-${pkgver}/distribute/bin"/* "${pkgdir}/usr/bin"
# library
- cp -a lib/libcaffe.so* "${pkgdir}/usr/lib"
+ cp -a "caffe-${pkgver}/distribute/lib"/libcaffe.so* "${pkgdir}/usr/lib"
chmod 755 "${pkgdir}/usr/lib"/libcaffe.so.*.*.*
# headers
- cp -a include "${pkgdir}/usr"
+ cp -a "caffe-${pkgver}/distribute/include" "${pkgdir}/usr"
# python
- install -m755 python/*.py "${pkgdir}/usr/bin"
- cp -a python/caffe "${pkgdir}/usr/lib/python${_pyver}/site-packages"
+ install -m755 "caffe-${pkgver}/distribute/python"/*.py "${pkgdir}/usr/bin"
+ cp -a "caffe-${pkgver}/distribute/python/caffe" "${pkgdir}/usr/lib/python${_pyver}/site-packages"
# proto
- install -D -m644 proto/caffe.proto -t "${pkgdir}/usr/share/caffe"
-
- cd "${srcdir}/caffe-${pkgver}"
+ install -D -m644 "caffe-${pkgver}/distribute/proto/caffe.proto" -t "${pkgdir}/usr/share/caffe"
# docs
- cp -a doxygen/html "${pkgdir}/usr/share/doc/${pkgname}"
+ cp -a "caffe-${pkgver}/doxygen/html" "${pkgdir}/usr/share/doc/${pkgname}"
# license
- install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -D -m644 "caffe-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
diff --git a/caffe-1.0-opencv4-fix.patch b/caffe-1.0-opencv4-fix.patch
deleted file mode 100644
index 1aef32f2eab..00000000000
--- a/caffe-1.0-opencv4-fix.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 7f503bd9a19758a173064e299ab9d4cac65ed60f Mon Sep 17 00:00:00 2001
-From: Daniel Bermond <danielbermond@gmail.com>
-Date: Mon, 26 Nov 2018 13:11:23 +0000
-Subject: [PATCH] Fix build with OpenCV 4.0
-
----
- Makefile | 16 ++++++++++++++--
- Makefile.config.example | 2 +-
- src/caffe/layers/window_data_layer.cpp | 2 +-
- src/caffe/test/test_io.cpp | 4 ++--
- src/caffe/util/io.cpp | 8 ++++----
- 5 files changed, 22 insertions(+), 10 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index b7660e852d6..95f3443adab 100644
---- a/Makefile
-+++ b/Makefile
-@@ -200,9 +200,17 @@ endif
- ifeq ($(USE_OPENCV), 1)
- LIBRARIES += opencv_core opencv_highgui opencv_imgproc
-
-- ifeq ($(OPENCV_VERSION), 3)
-+ ifeq ($(OPENCV_VERSION), $(filter $(OPENCV_VERSION), 3 4))
- LIBRARIES += opencv_imgcodecs
- endif
-+ ifeq ($(OPENCV_VERSION), 4)
-+ ifeq ($(USE_PKG_CONFIG), 1)
-+ INCLUDE_DIRS += $(shell pkg-config opencv4 --cflags-only-I | sed 's/-I//g')
-+ else
-+ INCLUDE_DIRS += /usr/include/opencv4 /usr/local/include/opencv4
-+ INCLUDE_DIRS += /usr/include/opencv4/opencv /usr/local/include/opencv4/opencv
-+ endif
-+ endif
-
- endif
- PYTHON_LIBRARIES ?= boost_python python2.7
-@@ -429,7 +437,11 @@ LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
-
- USE_PKG_CONFIG ?= 0
- ifeq ($(USE_PKG_CONFIG), 1)
-- PKG_CONFIG := $(shell pkg-config opencv --libs)
-+ ifeq ($(OPENCV_VERSION), 4)
-+ PKG_CONFIG := $(shell pkg-config opencv4 --libs)
-+ else
-+ PKG_CONFIG := $(shell pkg-config opencv --libs)
-+ endif
- else
- PKG_CONFIG :=
- endif
-diff --git a/Makefile.config.example b/Makefile.config.example
-index 24ca632783a..24802e91534 100644
---- a/Makefile.config.example
-+++ b/Makefile.config.example
-@@ -19,7 +19,7 @@
- # possibility of simultaneous read and write
- # ALLOW_LMDB_NOLOCK := 1
-
--# Uncomment if you're using OpenCV 3
-+# Uncomment and set accordingly if you're using OpenCV 3/4
- # OPENCV_VERSION := 3
-
- # To customize your choice of compiler, uncomment and set the following.
-diff --git a/src/caffe/layers/window_data_layer.cpp b/src/caffe/layers/window_data_layer.cpp
-index 1bf3760e9fd..f41169debe4 100644
---- a/src/caffe/layers/window_data_layer.cpp
-+++ b/src/caffe/layers/window_data_layer.cpp
-@@ -290,7 +290,7 @@ void WindowDataLayer<Dtype>::load_batch(Batch<Dtype>* batch) {
- image_database_cache_[window[WindowDataLayer<Dtype>::IMAGE_INDEX]];
- cv_img = DecodeDatumToCVMat(image_cached.second, true);
- } else {
-- cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
-+ cv_img = cv::imread(image.first, cv::IMREAD_COLOR);
- if (!cv_img.data) {
- LOG(ERROR) << "Could not open or find file " << image.first;
- return;
-diff --git a/src/caffe/test/test_io.cpp b/src/caffe/test/test_io.cpp
-index c2c919e90dc..b80df287fba 100644
---- a/src/caffe/test/test_io.cpp
-+++ b/src/caffe/test/test_io.cpp
-@@ -20,8 +20,8 @@ class IOTest : public ::testing::Test {};
- bool ReadImageToDatumReference(const string& filename, const int label,
- const int height, const int width, const bool is_color, Datum* datum) {
- cv::Mat cv_img;
-- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
-- CV_LOAD_IMAGE_GRAYSCALE);
-+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
-+ cv::IMREAD_GRAYSCALE);
-
- cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag);
- if (!cv_img_origin.data) {
-diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp
-index 5295d9dddb9..1f9167a114f 100644
---- a/src/caffe/util/io.cpp
-+++ b/src/caffe/util/io.cpp
-@@ -73,8 +73,8 @@ void WriteProtoToBinaryFile(const Message& proto, const char* filename) {
- cv::Mat ReadImageToCVMat(const string& filename,
- const int height, const int width, const bool is_color) {
- cv::Mat cv_img;
-- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
-- CV_LOAD_IMAGE_GRAYSCALE);
-+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
-+ cv::IMREAD_GRAYSCALE);
- cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag);
- if (!cv_img_origin.data) {
- LOG(ERROR) << "Could not open or find file " << filename;
-@@ -179,8 +179,8 @@ cv::Mat DecodeDatumToCVMat(const Datum& datum, bool is_color) {
- CHECK(datum.encoded()) << "Datum not encoded";
- const string& data = datum.data();
- std::vector<char> vec_data(data.c_str(), data.c_str() + data.size());
-- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
-- CV_LOAD_IMAGE_GRAYSCALE);
-+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
-+ cv::IMREAD_GRAYSCALE);
- cv_img = cv::imdecode(vec_data, cv_read_flag);
- if (!cv_img.data) {
- LOG(ERROR) << "Could not decode datum ";