public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] Refactor virtual/opencl to provide the API, not an implementation
@ 2020-04-04 21:59 Marek Szuba
  2020-04-04 21:59 ` [gentoo-dev] [PATCH] virtual/opencl: new version Marek Szuba
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szuba @ 2020-04-04 21:59 UTC (permalink / raw
  To: gentoo-dev

As proposed in my e-mail to the list from two days ago. Advantage:
OpenCL-aware ebuilds will have something to compile and link against
regardless of whether the runtime invoked by the ICD loader supports
abi_x86_32 or not, or indeed even if there is no suitable runtime in the
Gentoo tree.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH] virtual/opencl: new version
  2020-04-04 21:59 [gentoo-dev] [PATCH] Refactor virtual/opencl to provide the API, not an implementation Marek Szuba
@ 2020-04-04 21:59 ` Marek Szuba
  2020-04-05  5:44   ` Michał Górny
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szuba @ 2020-04-04 21:59 UTC (permalink / raw
  To: gentoo-dev

Instead of pulling in various OpenCL runtimes, only depend on
eselect-opencl and an OpenCL ICD loader (dev-libs/ocl-icd) in order
to provide hardware-independent header files and libraries for
OpenCL-aware software to build against. Actual runtimes are now simply
suggested to the user via a postinst message.

Signed-off-by: Marek Szuba <marecki@gentoo.org>
---
 virtual/opencl/opencl-3.ebuild | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 virtual/opencl/opencl-3.ebuild

diff --git a/virtual/opencl/opencl-3.ebuild b/virtual/opencl/opencl-3.ebuild
new file mode 100644
index 00000000000..9851d1ccbeb
--- /dev/null
+++ b/virtual/opencl/opencl-3.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit multilib-build
+
+DESCRIPTION="Virtual for OpenCL API"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="app-eselect/eselect-opencl
+	dev-libs/ocl-icd[khronos-headers,${MULTILIB_USEDEP}]"
+
+pkg_postinst() {
+	elog
+	elog "In order to take advantage of OpenCL you will need a runtime for your hardware."
+	elog "Currently included in Gentoo are:"
+	elog
+	elog "    dev-libs/intel-neo - integrated Intel GPUs from Broadwell onwards. Open. 64-bit only"
+	elog "    dev-libs/rocm-opencl-runtime - AMD GPUs supported by the amdgpu kernel driver. Mostly open [1]. 64-bit only"
+	elog "    media-libs/mesa[opencl] - some older AMD GPUs; see [2]. Open. 32-bit support"
+	elog "    dev-libs/amdgpu-pro-opencl - AMD Polaris GPUs. Proprietary, provided as-is. 32-bit support"
+	elog "    dev-util/intel-ocl-sdk - Intel CPUs. Proprietary. 64-bit only"
+	elog "    x11-drivers/nvidia-drivers[uvm] - Nvidia GPUs; specific package versions required for older ones [3]. Proprietary. 32-bit support"
+	elog
+	elog " [1] Proprietary library from dev-libs/hsa-ext-rocr required for image support"
+	elog " [2] https://dri.freedesktop.org/wiki/GalliumCompute/"
+	elog " [3] https://www.nvidia.com/en-us/drivers/unix/legacy-gpu/"
+	elog
+}
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] virtual/opencl: new version
  2020-04-04 21:59 ` [gentoo-dev] [PATCH] virtual/opencl: new version Marek Szuba
@ 2020-04-05  5:44   ` Michał Górny
  2020-04-05 19:18     ` Marek Szuba
  0 siblings, 1 reply; 5+ messages in thread
From: Michał Górny @ 2020-04-05  5:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2499 bytes --]

On Sat, 2020-04-04 at 22:59 +0100, Marek Szuba wrote:
> Instead of pulling in various OpenCL runtimes, only depend on
> eselect-opencl and an OpenCL ICD loader (dev-libs/ocl-icd) in order
> to provide hardware-independent header files and libraries for
> OpenCL-aware software to build against. Actual runtimes are now simply
> suggested to the user via a postinst message.
> 
> Signed-off-by: Marek Szuba <marecki@gentoo.org>
> ---
>  virtual/opencl/opencl-3.ebuild | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 virtual/opencl/opencl-3.ebuild
> 
> diff --git a/virtual/opencl/opencl-3.ebuild b/virtual/opencl/opencl-3.ebuild
> new file mode 100644
> index 00000000000..9851d1ccbeb
> --- /dev/null
> +++ b/virtual/opencl/opencl-3.ebuild
> @@ -0,0 +1,31 @@
> +# Copyright 1999-2020 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +EAPI=6

Is there really a good reason to use an old EAPI here?

> +
> +inherit multilib-build
> +
> +DESCRIPTION="Virtual for OpenCL API"
> +SLOT="0"
> +KEYWORDS="~amd64 ~x86"
> +
> +RDEPEND="app-eselect/eselect-opencl
> +	dev-libs/ocl-icd[khronos-headers,${MULTILIB_USEDEP}]"

Wouldn't it make sense to remove the virtual and just have stuff depend
on that instead?

> +
> +pkg_postinst() {
> +	elog
> +	elog "In order to take advantage of OpenCL you will need a runtime for your hardware."
> +	elog "Currently included in Gentoo are:"
> +	elog
> +	elog "    dev-libs/intel-neo - integrated Intel GPUs from Broadwell onwards. Open. 64-bit only"
> +	elog "    dev-libs/rocm-opencl-runtime - AMD GPUs supported by the amdgpu kernel driver. Mostly open [1]. 64-bit only"
> +	elog "    media-libs/mesa[opencl] - some older AMD GPUs; see [2]. Open. 32-bit support"
> +	elog "    dev-libs/amdgpu-pro-opencl - AMD Polaris GPUs. Proprietary, provided as-is. 32-bit support"
> +	elog "    dev-util/intel-ocl-sdk - Intel CPUs. Proprietary. 64-bit only"
> +	elog "    x11-drivers/nvidia-drivers[uvm] - Nvidia GPUs; specific package versions required for older ones [3]. Proprietary. 32-bit support"
> +	elog
> +	elog " [1] Proprietary library from dev-libs/hsa-ext-rocr required for image support"
> +	elog " [2] https://dri.freedesktop.org/wiki/GalliumCompute/"
> +	elog " [3] https://www.nvidia.com/en-us/drivers/unix/legacy-gpu/"
> +	elog
> +}

This looks like README.gentoo material.

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-dev] [PATCH] virtual/opencl: new version
  2020-04-05  5:44   ` Michał Górny
@ 2020-04-05 19:18     ` Marek Szuba
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Szuba @ 2020-04-05 19:18 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1410 bytes --]

On 2020-04-05 06:44, Michał Górny wrote:

>> +EAPI=6
> Is there really a good reason to use an old EAPI here?

None other than me having assumed that there must have been an important
reason why such a simple ebuild had not been bumped to EAPI 7 yet. Will
change this in the next iteration.

>> +RDEPEND="app-eselect/eselect-opencl
>> +	dev-libs/ocl-icd[khronos-headers,${MULTILIB_USEDEP}]"
> 
> Wouldn't it make sense to remove the virtual and just have stuff depend
> on that instead?

It would if there only were only one ICD loader in the tree - but there
are two, this one and dev-libs/opencl-icd-loader. Overall it seems the
latter might be preferable in the long run (official Khronos Group
loader, much smaller output library, supports the new unified headers,
the last ocl-icd release came out in November 2017 and there has been
minimal repo activity since then) but with it having only been
officially released in mid-March and with me having only just added it
to Gentoo, I feel I'd rather test it for a while before listing it as an
alternative in the virtual.

Moreover, for the time being we still need eselect-opencl here even if
we are no longer to use to switch between implementations because
somewhat surprisingly (to me anyway), the package in questions installs
OpenCL header files too.

> This looks like README.gentoo material.

Will do.

-- 
MS


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-dev] [PATCH] virtual/opencl: new version
  2020-04-06 22:05 [gentoo-dev] [PATCH v2] Refactor virtual/opencl to provide the API, not an implementation Marek Szuba
@ 2020-04-06 22:05 ` Marek Szuba
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Szuba @ 2020-04-06 22:05 UTC (permalink / raw
  To: gentoo-dev

One, instead of pulling in various OpenCL runtimes, only depend on
an OpenCL ICD loader (dev-libs/ocl-icd, with dev-libs/opencl-icd-loader
to be added later) in order to provide hardware-independent header
files and libraries for OpenCL-aware software to build against.
Actual runtimes are now simply suggested to the user via a postinst
message / README.gentoo file.

Two, do not depend on eselect-opencl either - both ICD loaders pull in
their own OpenCL headers so there is no need to depend on the legacy
headers provided by this package, and for being able to switch to a
specific loader it is enough for loaders themselves to depend on this.

Signed-off-by: Marek Szuba <marecki@gentoo.org>
---
 virtual/opencl/files/README.gentoo | 18 ++++++++++++++++++
 virtual/opencl/opencl-3.ebuild     | 25 +++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 virtual/opencl/files/README.gentoo
 create mode 100644 virtual/opencl/opencl-3.ebuild

diff --git a/virtual/opencl/files/README.gentoo b/virtual/opencl/files/README.gentoo
new file mode 100644
index 00000000000..aa2dc0ef519
--- /dev/null
+++ b/virtual/opencl/files/README.gentoo
@@ -0,0 +1,18 @@
+In order to take advantage of OpenCL you will need a runtime for your hardware.
+Currently included in Gentoo are:
+
+ * open:
+    - dev-libs/intel-neo - integrated Intel GPUs from Broadwell onwards. 64-bit only;
+    - dev-libs/rocm-opencl-runtime - AMD GPUs supported by the amdgpu kernel driver.
+      Image support still requires a proprietary extension [1]. 64-bit only;
+    - media-libs/mesa[opencl] - some older AMD GPUs; see [2]. 32-bit support;
+
+ * proprietary:
+    - dev-libs/amdgpu-pro-opencl - AMD Polaris GPUs. 32-bit support;
+    - dev-util/intel-ocl-sdk - Intel CPUs (*not* GPUs). 64-bit only;
+    - x11-drivers/nvidia-drivers[uvm] - Nvidia GPUs; specific package versions
+      required for older devices [3]. 32-bit support.
+
+ [1] dev-libs/hsa-ext-rocr
+ [2] https://dri.freedesktop.org/wiki/GalliumCompute/
+ [3] https://www.nvidia.com/en-us/drivers/unix/legacy-gpu/
diff --git a/virtual/opencl/opencl-3.ebuild b/virtual/opencl/opencl-3.ebuild
new file mode 100644
index 00000000000..6268723a166
--- /dev/null
+++ b/virtual/opencl/opencl-3.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-build readme.gentoo-r1
+
+DESCRIPTION="Virtual for OpenCL API"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+# Will add dev-libs/opencl-icd-loader here as an alternative once all potential
+# file collisions with eselect-opencl have been resolved
+RDEPEND="dev-libs/ocl-icd[khronos-headers,${MULTILIB_USEDEP}]"
+
+# so that src_install() doesn't fail on missing directory
+S="${WORKDIR}"
+
+src_install() {
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-06 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-04 21:59 [gentoo-dev] [PATCH] Refactor virtual/opencl to provide the API, not an implementation Marek Szuba
2020-04-04 21:59 ` [gentoo-dev] [PATCH] virtual/opencl: new version Marek Szuba
2020-04-05  5:44   ` Michał Górny
2020-04-05 19:18     ` Marek Szuba
  -- strict thread matches above, loose matches on Subject: below --
2020-04-06 22:05 [gentoo-dev] [PATCH v2] Refactor virtual/opencl to provide the API, not an implementation Marek Szuba
2020-04-06 22:05 ` [gentoo-dev] [PATCH] virtual/opencl: new version Marek Szuba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox