1 |
commit: ae1a20ab64b2b032794c1543b707445d17b49a7d |
2 |
Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri May 14 01:27:07 2021 +0000 |
4 |
Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> |
5 |
CommitDate: Fri May 14 01:27:46 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=ae1a20ab |
7 |
|
8 |
dev-libs/pocl: initial import |
9 |
|
10 |
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com> |
11 |
|
12 |
dev-libs/pocl/Manifest | 1 + |
13 |
.../pocl/files/vendor_opencl_libs_location.patch | 20 +++++ |
14 |
dev-libs/pocl/metadata.xml | 30 ++++++++ |
15 |
dev-libs/pocl/pocl-1.6.ebuild | 87 ++++++++++++++++++++++ |
16 |
4 files changed, 138 insertions(+) |
17 |
|
18 |
diff --git a/dev-libs/pocl/Manifest b/dev-libs/pocl/Manifest |
19 |
new file mode 100644 |
20 |
index 000000000..0be7d35d8 |
21 |
--- /dev/null |
22 |
+++ b/dev-libs/pocl/Manifest |
23 |
@@ -0,0 +1 @@ |
24 |
+DIST pocl-1.6.tar.gz 1595212 BLAKE2B ee628ec466df03c44f02235c78b516aeea0e02f82ce095cd798d6d4d4cf81773adf16493837306243ac7e0de58b2ccfbdcfb3a63ff8e287f6c83c58160811712 SHA512 ecd3a3867a62a2a555183741fa4586eeefae00514d66d15a79b9094ff0a0248b213f62ab23b3e61bdb1042e760cd34b07e546f97b304ac86c3f861a9161df1b1 |
25 |
|
26 |
diff --git a/dev-libs/pocl/files/vendor_opencl_libs_location.patch b/dev-libs/pocl/files/vendor_opencl_libs_location.patch |
27 |
new file mode 100644 |
28 |
index 000000000..548589ca4 |
29 |
--- /dev/null |
30 |
+++ b/dev-libs/pocl/files/vendor_opencl_libs_location.patch |
31 |
@@ -0,0 +1,20 @@ |
32 |
+--- a/CMakeLists.txt |
33 |
++++ b/CMakeLists.txt |
34 |
+@@ -125,7 +125,7 @@ |
35 |
+ endif() |
36 |
+ |
37 |
+ # for libpocl.so |
38 |
+-set(POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH "POCL public libdir") |
39 |
++set(POCL_INSTALL_PUBLIC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/OpenCL/vendors/pocl" CACHE PATH "POCL public libdir") |
40 |
+ |
41 |
+ # for llvmopencl.so |
42 |
+ set(POCL_INSTALL_PRIVATE_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pocl" CACHE PATH "POCL private libdir") |
43 |
+@@ -134,7 +134,7 @@ |
44 |
+ if(UNIX AND NOT CMAKE_CROSSCOMPILING AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
45 |
+ set(POCL_INSTALL_ICD_VENDORDIR "/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
46 |
+ else() |
47 |
+- set(POCL_INSTALL_ICD_VENDORDIR "${CMAKE_INSTALL_PREFIX}/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
48 |
++ set(POCL_INSTALL_ICD_VENDORDIR "${SYSCONFDIR}/etc/OpenCL/vendors" CACHE PATH "POCL ICD file destination") |
49 |
+ endif() |
50 |
+ |
51 |
+ # for kernel-<target>.bc |
52 |
|
53 |
diff --git a/dev-libs/pocl/metadata.xml b/dev-libs/pocl/metadata.xml |
54 |
new file mode 100644 |
55 |
index 000000000..5070dbc08 |
56 |
--- /dev/null |
57 |
+++ b/dev-libs/pocl/metadata.xml |
58 |
@@ -0,0 +1,30 @@ |
59 |
+<?xml version="1.0" encoding="UTF-8"?> |
60 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
61 |
+<pkgmetadata> |
62 |
+ <maintainer type="person"> |
63 |
+ <description>comaintainers welcome</description> |
64 |
+ <email>lssndrbarbieri@×××××.com</email> |
65 |
+ <name>Alessandro Barbieri</name> |
66 |
+ </maintainer> |
67 |
+ <longdescription lang="en"> |
68 |
+PoCL is a portable open source (MIT-licensed) implementation of the OpenCL standard (1.2 with some 2.0 features supported). In addition to being an easily portable multi-device (truely heterogeneous) open-source OpenCL implementation, a major goal of this project is improving interoperability of diversity of OpenCL-capable devices by integrating them to a single centrally orchestrated platform. Also one of the key goals longer term is to enhance performance portability of OpenCL programs across device types utilizing runtime and compiler techniques. |
69 |
+ |
70 |
+Upstream PoCL currently supports various CPUs, NVIDIA GPUs via libcuda, HSA-supported GPUs and TCE ASIPs (experimental, see: OpenASIP). It is also known to have multiple (private) adaptations in active production use. |
71 |
+ |
72 |
+PoCL uses Clang as an OpenCL C frontend and LLVM for kernel compiler implementation, and as a portability layer. Thus, if your desired target has an LLVM backend, it should be able to get OpenCL support easily by using PoCL. |
73 |
+ </longdescription> |
74 |
+ <upstream> |
75 |
+ <remote-id type="github">pocl/pocl</remote-id> |
76 |
+ </upstream> |
77 |
+ <use> |
78 |
+ <flag name="accel">Enable the generic hardware accelerator device driver</flag> |
79 |
+ <flag name="cl20">Enable reporting OpenCL 2.0 for the CPU device</flag> |
80 |
+ <flag name="conformance">Ensures that certain build options which would result in non-conformant pocl build stay disabled. Note that this does not quarantee a fully conformant build of pocl by itself</flag> |
81 |
+ <flag name="cuda">Enable the CUDA backend for NVIDIA GPUs</flag> |
82 |
+ <flag name="float-conversion">When enabled, OpenCL printf() call's f/e/g formatters are handled by pocl. When disabled, these are handled by system C library.</flag> |
83 |
+ <flag name="hardening">Enable hardening against various attacks. May worsen performance</flag> |
84 |
+ <!--<flag name="hsa">Enable the HSA base profile runtime device driver</flag>--> |
85 |
+ <flag name="hwloc">Enable hwloc support</flag> |
86 |
+ <flag name="memmanager">Enables custom memory manager. Except for special circumstances, this should be disabled</flag> |
87 |
+ </use> |
88 |
+</pkgmetadata> |
89 |
|
90 |
diff --git a/dev-libs/pocl/pocl-1.6.ebuild b/dev-libs/pocl/pocl-1.6.ebuild |
91 |
new file mode 100644 |
92 |
index 000000000..cef334945 |
93 |
--- /dev/null |
94 |
+++ b/dev-libs/pocl/pocl-1.6.ebuild |
95 |
@@ -0,0 +1,87 @@ |
96 |
+# Copyright 1999-2019 Gentoo Authors |
97 |
+# Distributed under the terms of the GNU General Public License v2 |
98 |
+ |
99 |
+EAPI="7" |
100 |
+ |
101 |
+DOCS_AUTODOC=0 |
102 |
+DOCS_BUILDER="sphinx" |
103 |
+DOCS_DIR="doc/sphinx/source" |
104 |
+PYTHON_COMPAT=( python3_{7..9} ) |
105 |
+ |
106 |
+inherit cmake llvm python-any-r1 docs |
107 |
+ |
108 |
+LLVM_MAX_SLOT=11 |
109 |
+ |
110 |
+DESCRIPTION="Portable Computing Language (an implementation of OpenCL)" |
111 |
+HOMEPAGE=" |
112 |
+ http://portablecl.org |
113 |
+ https://github.com/pocl/pocl |
114 |
+" |
115 |
+SRC_URI="https://github.com/pocl/pocl/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
116 |
+ |
117 |
+LICENSE="GPL-2" |
118 |
+SLOT="0" |
119 |
+KEYWORDS="~amd64" |
120 |
+IUSE="accel cl20 +conformance cuda debug examples float-conversion hardening +hwloc memmanager" #hsa tce |
121 |
+ |
122 |
+#TODO: add dependencies for cuda |
123 |
+RDEPEND=" |
124 |
+ dev-libs/libltdl |
125 |
+ sys-devel/llvm:${LLVM_MAX_SLOT} |
126 |
+ virtual/opencl |
127 |
+ |
128 |
+ !cuda? ( sys-devel/clang:${LLVM_MAX_SLOT} ) |
129 |
+ cuda? ( sys-devel/clang:${LLVM_MAX_SLOT}[llvm_targets_NVPTX] ) |
130 |
+ debug? ( dev-util/lttng-ust ) |
131 |
+ hwloc? ( sys-apps/hwloc[cuda?] ) |
132 |
+" |
133 |
+DEPEND=" |
134 |
+ ${RDEPEND} |
135 |
+ doc? ( $(python_gen_any_dep '<dev-python/markupsafe-2.0[${PYTHON_USEDEP}]') ) |
136 |
+" |
137 |
+BDEPEND="virtual/pkgconfig" |
138 |
+ |
139 |
+PATCHES=( "${FILESDIR}/vendor_opencl_libs_location.patch" ) |
140 |
+ |
141 |
+src_configure() { |
142 |
+ llvm_pkg_setup |
143 |
+ local mycmakeargs=( |
144 |
+ -DBUILD_SHARED_LIBS=ON |
145 |
+ -DENABLE_HSA=OFF |
146 |
+ -DENABLE_ICD=ON |
147 |
+ -DENABLE_POCL_BUILDING=OFF |
148 |
+ -DKERNELLIB_HOST_CPU_VARIANTS=native |
149 |
+ -DPOCL_ICD_ABSOLUTE_PATH=OFF |
150 |
+ -DSTATIC_LLVM=OFF |
151 |
+ |
152 |
+ -DENABLE_ACCEL_DEVICE=$(usex accel) |
153 |
+ -DENABLE_CONFORMANCE=$(usex conformance) |
154 |
+ -DENABLE_CUDA=$(usex cuda) |
155 |
+ -DENABLE_HOST_CPU_DEVICE_CL20=$(usex cl20) |
156 |
+ -DENABLE_HWLOC=$(usex hwloc) |
157 |
+ -DENABLE_POCL_FLOAT_CONVERSION=$(usex float-conversion) |
158 |
+ -DHARDENING_ENABLE=$(usex hardening) |
159 |
+ -DPOCL_DEBUG_MESSAGES=$(usex debug) |
160 |
+ -DUSE_POCL_MEMMANAGER=$(usex memmanager) |
161 |
+ -DWITH_LLVM_CONFIG=$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config |
162 |
+ ) |
163 |
+ cmake_src_configure |
164 |
+} |
165 |
+ |
166 |
+src_compile() { |
167 |
+ cmake_src_compile |
168 |
+ docs_compile |
169 |
+} |
170 |
+ |
171 |
+src_install() { |
172 |
+ cmake_src_install |
173 |
+ dodoc CREDITS README CHANGES |
174 |
+ if use doc; then |
175 |
+ dodoc -r _build/html |
176 |
+ docompress -x "/usr/share/doc/${P}/html" |
177 |
+ fi |
178 |
+ if use examples; then |
179 |
+ dodoc -r examples |
180 |
+ docompress -x "/usr/share/doc/${P}/examples" |
181 |
+ fi |
182 |
+} |