blob: 40ab4dfea75d463f504c8e7b0036158c84b28e46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{13..14} )
ROCM_VERSION=6.3
CUDA_DEVICE_TARGETS=1
inherit cmake cuda python-any-r1 rocm
DESCRIPTION="Intel Open Image Denoise library"
HOMEPAGE="https://www.openimagedenoise.org https://github.com/RenderKit/oidn"
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://github.com/RenderKit/oidn.git"
EGIT_BRANCH="master"
EGIT_LFS="1"
inherit git-r3
else
SRC_URI="https://github.com/RenderKit/${PN}/releases/download/v${PV}/${P}.src.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 -arm ~arm64 -ppc ~ppc64 -x86" # 64-bit-only
fi
LICENSE="Apache-2.0"
SLOT="0/${PV}"
IUSE="apps cuda hip openimageio test"
REQUIRED_USE="
test? ( apps )
"
RESTRICT="!test? ( test )"
RDEPEND="
dev-cpp/tbb:=
dev-lang/ispc
cuda? (
dev-util/nvidia-cuda-toolkit:=
dev-libs/cutlass
)
hip? (
dev-util/hip:=
)
openimageio? ( media-libs/openimageio:= )
"
DEPEND="${RDEPEND}"
BDEPEND="${PYTHON_DEPS}"
PATCHES=(
"${FILESDIR}/${PN}-2.3.3-amdgpu-targets.patch"
)
src_prepare() {
if use cuda; then
cuda_src_prepare
fi
if use hip; then
# https://bugs.gentoo.org/930391
sed "/-Wno-unused-result/s:): --rocm-path=${EPREFIX}/usr):" \
-i devices/hip/CMakeLists.txt || die
fi
# do not fortify source -- bug 895018
sed -e "s/-D_FORTIFY_SOURCE=2//g" -i {cmake/oidn_platform,external/mkl-dnn/cmake/SDL}.cmake || die
# Don't de-bundle composable_kernel for two reasons:
# 1. sci-libs/composable-kernel takes a very long time to compile and oidn only uses a subset of it.
# 2. We've run into compilation issues when trying to debundle it. See #955869
rm -r external/{cutlass,mkl-dnn} || die
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DOIDN_APPS="$(usex apps)"
-DOIDN_LIBRARY_VERSIONED="yes"
-DOIDN_DEVICE_CPU="yes"
-DOIDN_DEVICE_CUDA="$(usex cuda)"
-DOIDN_DEVICE_HIP="$(usex hip)"
# -DOIDN_DEVICE_SYCL="$(usex sycl)"
)
if use apps; then
mycmakeargs+=( -DOIDN_APPS_OPENIMAGEIO="$(usex openimageio)" )
fi
if use cuda; then
export CUDAHOSTCXX="$(cuda_gccdir)"
fi
if use hip; then
mycmakeargs+=(
-DROCM_PATH="${EPREFIX}/usr"
-DOIDN_DEVICE_HIP_COMPILER="${ESYSROOT}/usr/bin/hipcc" # use HIPHOSTCOMPILER
-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
)
fi
cmake_src_configure
}
src_compile() {
if use cuda; then
addpredict /dev/char/
cuda_add_sandbox
fi
cmake_src_compile
}
src_test() {
if use cuda; then
addpredict /dev/char/
cuda_add_sandbox
fi
"${BUILD_DIR}"/oidnTest || die "There were test failures!"
}
src_install() {
cmake_src_install
if use hip || use cuda ; then
# remove garbage in /var/tmp left by subprojects
rm -r "${ED}"/var || die
fi
}
|