On Tue, 24 Apr 2012 13:18:55 -0500, "Brennan, Brian" <[email protected]> 
wrote:
> Hello Andreas,
>     I had a quick question about contexts and choosing the platform to run 
> on. When I run my code I am prompted with:
> 
> Choose platform:
> [0] <pyopencl.Platform 'Intel(R) OpenCL' at 0x1594c00>
> [1] <pyopencl.Platform 'AMD Accelerated Parallel Processing' at 
> 0x7f0fc2245060>
> Choice [0]:
> 
> Now, I can set a default value through the shell with:   export PYOPENCL_CTX=0
> 
> but I am trying to run comparisons between GPU and CPU run times and
> would like to class my script twice with each value '0' and '1' being
> set in the code. Is there a command I can type into my script to set
> this rather than being prompted each time?

(cc'ing PyOpenCL list)

Undocumented keyword argument:

cl.create_some_context(answers=[0])

:)

That said, what create_some_context does is really easily done manually,
too:

plat = cl.get_platforms()[plat_index]
dev = plat.get_devices()[dev_index]
ctx = cl.Context([dev])

Andreas

Attachment: pgprPGkv17Gpb.pgp
Description: PGP signature

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to