Accéder au contenu.
Menu Sympa

starpu-devel - Re: [Starpu-devel] StarPU SVN and OpenCL on CPU

Objet : Developers list for StarPU

Archives de la liste

Re: [Starpu-devel] StarPU SVN and OpenCL on CPU


Chronologique Discussions 
  • From: George Russell <george@codeplay.com>
  • To: starpu-devel@lists.gforge.inria.fr
  • Subject: Re: [Starpu-devel] StarPU SVN and OpenCL on CPU
  • Date: Wed, 23 Feb 2011 21:40:02 +0100
  • List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
  • List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>

Hi,

Great that it works ;-)

Could you post a patch against the StarPU SVN trunk for this? I am not terribly concerned about the "hackiness" of this at the moment, as I simply want to see how I can get OpenCL code running in StarPU on the CPU as I at present don't have access to an OpenCL GPU in a context where StarPU will build!

Cheers,
George

On 23/02/2011 20:32, Sylvain HENRY wrote:
4D6560BF.9090803@inria.fr"> Hi George,

I succeeded in using StarPU with the AMD Stream SDK on CPU but it requires a hack.

The problem is that StarPU uses asynchronous data transfers and uses polling (clGetEventInfo(CL_EVENT_COMMAND_EXECUTION_STATUS...)) to know when a transfer is terminated. But it seems that the asynchronous data transfer (i.e. memcpy) is never performed by AMD Stream. A blocking call is required for the transfer to be performed...

A first simple solution would be to detect when the worker is an OpenCL CPU device and to somehow force the call to be blocking.

The solution I used is different. Because I wanted to avoid the superfluous memcpy, I used an OpenCL buffer created with the flag CL_MEM_USE_HOST_PTR. Each time StarPU wants to transfer data from host memory to the OpenCL CPU device, it calls a function with the source address and the target buffer. This is where I free the buffer and replace it with a new one "mapping" the data.

This hack worked for me because I only had OpenCL devices (no CPU worker from a StarPU point of view, only OpenCL ones). With CPU workers, data may get corrupted as we are faking a copy.

The long term solution would be for StarPU to consider OpenCL CPU devices as CPU workers, that is, workers performing their computations in host memory (and using CPU cores... but this is another story).

Cheers
Sylvain




Archives gérées par MHonArc 2.6.19+.

Haut de le page