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

Re: on detecting OpenCL compute capability



On 07/08/15 15:35, Gert Wollny wrote:

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.


Yes. I was thinking of something like:
pocl-opencl-icd | opencl-icd

Where opencl-icd is a virtual package which may be provided by an alternative free (Beignet, Mesa) or non-free (AMD, Nvidia) implementation if need be.

I was quite surprised by the limited number of architectures supported by pocl-opencl-icd, but it seems that work is in progress to get more architectures working, according to the changelog.


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


This is exactly what I was looking for.

Many thanks Gert.

Ghis


Reply to: