aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Cho2021-02-24 11:48:33 +0900
committerXavier Cho2021-02-24 11:50:49 +0900
commit7741ecb05ce0464d0304a51e4b717d53d06ced3a (patch)
tree51394b1802764d60c201c461c51c795408d56146
parentc4cb38e1196917143f4aafcffe978a7054155523 (diff)
downloadaur-7741ecb05ce0464d0304a51e4b717d53d06ced3a.tar.gz
Prevent potential memory problem with CUDA
Adopted from blender-develop-git AUR package. Thanks bartus!
-rw-r--r--.SRCINFO2
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD17
-rw-r--r--SelectCudaComputeArch.patch16
4 files changed, 34 insertions, 3 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 01347bd4e28b..6bece3a9e072 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -47,6 +47,7 @@ pkgbase = upbge-git
source = blender-translations.git::git://git.blender.org/blender-translations.git
source = blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git
source = embree.patch
+ source = SelectCudaComputeArch.patch
source = upbge.desktop
md5sums = SKIP
md5sums = SKIP
@@ -54,6 +55,7 @@ pkgbase = upbge-git
md5sums = SKIP
md5sums = SKIP
md5sums = 1cd3132ec4e15df823d336529f5d1d6f
+ md5sums = 4441d9a6db38b85b7dc5c3c9e6872951
md5sums = 37ce92c740691f858156511e22b40143
pkgname = upbge-git
diff --git a/.gitignore b/.gitignore
index 44a9464c748b..0978be0225d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,6 @@
!upbge.install
!upbge.desktop
!embree.patch
-!cuda11.patch
+!SelectCudaComputeArch.patch
!.SRCINFO
!.gitignore
diff --git a/PKGBUILD b/PKGBUILD
index 15820268ceec..7071ff61b8e9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,7 +7,7 @@ pkgdesc="Uchronia Project Blender Game Engine fork of Blender Game Engine"
arch=('i686' 'x86_64')
url="https://upbge.org/"
depends=('embree' 'alembic' 'libgl' 'python' 'desktop-file-utils' 'hicolor-icon-theme' 'openjpeg'
- 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio-git' 'openimageio-qfix'
+ 'ffmpeg' 'fftw' 'openal' 'freetype2' 'libxi' 'openimageio-git' 'openimageio-qfix'
'opencolorio-git' 'opencolorio-qfix' 'potrace' 'openshadinglanguage-qfix'
'openvdb' 'opencollada' 'opensubdiv' 'libtiff' 'libpng' 'python-numpy')
optdepends=('cuda: CUDA support in Cycles'
@@ -29,6 +29,7 @@ source=('git://github.com/UPBGE/upbge.git' \
'blender-translations.git::git://git.blender.org/blender-translations.git' \
'blender-dev-tools.git::git://git.blender.org/blender-dev-tools.git' \
embree.patch \
+ SelectCudaComputeArch.patch \
upbge.desktop)
md5sums=(
'SKIP'
@@ -37,13 +38,21 @@ md5sums=(
'SKIP'
'SKIP'
'1cd3132ec4e15df823d336529f5d1d6f'
+ '4441d9a6db38b85b7dc5c3c9e6872951'
'37ce92c740691f858156511e22b40143')
# determine whether we can precompile CUDA kernels
_CUDA_PKG=`pacman -Qq cuda 2>/dev/null` || true
if [ "$_CUDA_PKG" != "" ]; then
- _EXTRAOPTS="-DWITH_CYCLES_CUDA_BINARIES=ON \
+ _EXTRAOPTS="$_EXTRAOPTS \
+ -DWITH_CYCLES_CUDA_BINARIES=ON \
-DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda"
+
+ [ -f "/usr/lib/ccache/bin/nvcc-ccache" ] && export CUDA_NVCC_EXECUTABLE=/usr/lib/ccache/bin/nvcc-ccache
+
+ if _cuda_gcc=$(basename "$(readlink /opt/cuda/bin/gcc)") ; then
+ [ -L "/usr/lib/ccache/bin/$_cuda_gcc" ] && export CUDAHOSTCXX=/usr/lib/ccache/bin/"$_cuda_gcc"
+ fi
fi
# check for optix
@@ -82,6 +91,10 @@ prepare() {
git submodule foreach git checkout master
git submodule foreach git pull --rebase --depth=1
+ if [ ! -v _cuda_capability ] && grep -q nvidia <(lsmod); then
+ git -C "$srcdir/upbge" apply -v "${srcdir}"/SelectCudaComputeArch.patch
+ fi
+
if [ "$_EMBREE_PKG" != "" ]; then
git apply -v "${srcdir}"/embree.patch
fi
diff --git a/SelectCudaComputeArch.patch b/SelectCudaComputeArch.patch
new file mode 100644
index 000000000000..c6b3ffc73d4f
--- /dev/null
+++ b/SelectCudaComputeArch.patch
@@ -0,0 +1,16 @@
+diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake
+index 5bf681792ca..b975fb5db14 100644
+--- a/intern/cycles/cmake/external_libs.cmake
++++ b/intern/cycles/cmake/external_libs.cmake
+@@ -41,6 +41,11 @@ if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
+ find_package(CUDA) # Try to auto locate CUDA toolkit
+ if(CUDA_FOUND)
+ message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}")
++ CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS Auto)
++ string(REGEX REPLACE " compute_[0-9]+" "" CYCLES_CUDA_BINARIES_ARCH "${CUDA_ARCH_FLAGS_readable}")
++ string(REGEX REPLACE " " ";" CYCLES_CUDA_BINARIES_ARCH "${CYCLES_CUDA_BINARIES_ARCH}")
++ message(STATUS "Enabling CUDA support (version: ${CUDA_VERSION_STRING},"
++ " archs: ${CYCLES_CUDA_BINARIES_ARCH})")
+ else()
+ message(STATUS "CUDA compiler not found, disabling WITH_CYCLES_CUDA_BINARIES")
+ set(WITH_CYCLES_CUDA_BINARIES OFF)