[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OpenCL in Debian

Le 10/07/2012 21:45, Tomasz Rybak a écrit :
> Thanks for extensive summary. I have one dimension to add to
> this table though: supported OpenCL versions.
> Currently Debian contains opencl-headers in version 1.2.
> Many programs when they encounter headers in particular
> version assume that they can expect libraries in the same version.
> This was problem with PyOpenCL when compiled with NVIDIA ICD loader:
> PyOpenCL compilation failed because NVIDIA ICD supports version 1.1
> while headers are in version 1.2. This resulted in PyOpenCL wanting
> to use non-present functions.
> Unfortunately I there is possibility to write:
> opencl-headers (= 1.1) & nvidia-libopencl1 | \
>  opencl-headers (= 1.2) & ( amd-libopencl1 | ocl-icl-libopencl1)
> in Build-Depends ;-) 

Not sure you will get what you want. the OpenCL version supported
by the ICD Loader does not say anything about the OpenCL version
supported by the ICD itself.

So, if you have opencl-headers (= 1.2), amd-libopencl1 and
nvidia-opencl-icd installed, you can compile a program for
OpenCL 1.2 but it will fail at runtime because the ICD Loader
(amd-libopencl1) will call random functions (random addresses)
in nvidia-opencl-icd when OpenCL 1.2 functions are used.
  It seems that there is no way that an ICD Loader can know
how many/which functions are available in the ICD implementations :-(

So, I think your build-depends ensure PyOpenCL can be compiled with
one OpenCL version compatible with the ICD Loader installed, but
it does nothing to ensure that it will run correctly (this depends
on the OpenCL version of the ICD(s) installed)

In summary:
With opencl-headers (= 1.1), you can compile OpenCL 1.1 programs
With opencl-headers (= 1.2), you can compile OpenCL 1.2 *and* 1.1 programs
  (you will perhaps need to define CL_USE_DEPRECATED_OPENCL_1_1_APIS for 1.1)

With nvidia-libopencl1, you can compile and run OpenCL 1.1 programs
With amd-libopencl1, you can compile and run OpenCL 1.1 *and* 1.2 programs
With ocl-icd-libopencl1, you can compile and run OpenCL 1.1 *and* 1.2 programs
With intel-libopencl1, you can compile and run OpenCL 1.1 *and* 1.2 programs

With nvidia-opencl-icd, you can run OpenCL 1.1 programs
With amd-opencl-icd, you can run OpenCL 1.1 *and* 1.2 programs
With intel-opencl-icd, you can run OpenCL 1.1 programs and call a few 1.2 functions

*-libopencl1 are not co-installable
But *-opencl-icd *are* co-installable (and are choose at runtime by the programs)

  About ICD Loaders (*-libopencl1), we can propose that they provide
libopencl-1.1 / libopencl-1.2 if they support it (ie amd-libopencl1 would provide
both). Would you be interested by it?
  About ICD, I do not see anything easy. As they are co-installable (by
design: this is the reason of development of a ICD Loader), the selection
must be done at runtime (ie not by dependencies). If we use virtual packages
(opencl-1.1, opencl-1.2) to be sure that a compatible ICD is installed.
But, to my knowledge, there is nothing in the ICD Loader API that can
be used to detect/select the good implementation (but a hard-coded
knowledge of compatible ICD)


Reply to: