Re: on detecting OpenCL compute capability
On Fri, 2015-08-07 at 14:54 +0100, Ghislain Vaillant wrote:
> On 07/08/15 13:07, Gert Wollny wrote:
> > Hello Ghislain,
> >
> >
> > On Fri, 2015-08-07 at 12:34 +0100, Ghislain Vaillant wrote:
> >> I have been packaging a few OpenCL libraries lately. For most of them,
> >> the test suite can only be run from an OpenCL capable machine.
> >
> > Since OpenCL can also run on the CPU it should be possible to get the
> > capability by pulling in a package that provides an CPU based
> > opencl-idc, e.g. pocl-opencl-icd.
> >
>
> You are correct. I guess *any* -icd package should do if we want to
> remain generic enough?
Well, I pointed out pocl-opencl-icd because it is in "main" and it
provides a CPU based implementation that seems to be cross platform.
Not sure how well it implements the specs though.
Pulling in non-free packages (like amd or nvidia -icd") during the build
might force you to put the package into "contrib" and these packages
have very limited hardware support.
> This expression gives me the number of platforms:
> clinfo | head -n1 | sed -e 's/.*[^0-9]\([0-9]\+\)[^0-9]*$/\1/'
>
> How do I create the override_dh_auto_test out of this?
>
> I apologize in advance for my modest bash skills.
Less bash, more make:
<<<<<<<<<<<<<<<<
num_opencl_platforms := $(shell clinfo | head -n1 |\
sed -e "s/.*[^0-9]\([0-9]\+\)[^0-9]*$$/\1/")
ifeq ($(num_opencl_platforms), 0)
override_dh_auto_test:
@echo "No OpenCL platform available, skipping test"
else
override_dh_auto_test:
dh_auto_test
endif
>>>>>>>>>>>>>>>>
Best,
Gert
Reply to: