Dear Andreas,
It is an Nvidia problem. I solved it by explicitly adding the
__write_only
flag to the texture buffer.
So the minimal running example now looks like:
__kernel void test(__write_only image2d_t d_output){
write_imagef(d_output,(int2)(1,1),(float4)(1.0f,1.0f,1.0f,1.0f));
}
I wonder why this is mentioned basically nowhere, but it seems to be
compatible
with AMD implementation, so I'll keep that as personal standard.
Thanks nevertheless
Jonathan
Am 2016-09-13 21:22, schrieb Andreas Kloeckner:
Dear Jonathan,
"Schock, Jonathan" <jonathan.sch...@tum.de> writes:
I'm failing to compile programs, using the write_imagef() functions on
Nvidia implementations.
Working with a 'Tesla K10.G2.8GB' using the driver version 367.35 on
python 2.7 with PyopenCL 2016.1,
I'm trying to compile the following program, which fails with a build
error:
Host Code
import pyopencl as cl
platform = cl.get_platforms()[0]
devs = platform.get_devices()
device1 = devs[1]
mf = cl.mem_flags
ctx = cl.Context([device1])
Queue1 = cl.CommandQueue(ctx)
f = open('Minimal.cl', 'r')
fstr = "".join(f.readlines())
prg = cl.Program(ctx, fstr).build()
Kernel (Minimal.cl)
__kernel void test(image2d_t d_output){
write_imagef(d_output,(int2)(1,1),(float4)(1.0f,1.0f,1.0f,1.0f));
}
The error I get is:
pyopencl.cffi_cl.RuntimeError: clbuildprogram failed:
BUILD_PROGRAM_FAILURE -
I checked, if my device has image support and that it supports reading
and writing to
texture buffers in the specified format. I think, that the same case
won't work for the 3d case,
because the extension 'cl_khr_3d_image_writes' is not supported on any
of our Nvidia device,
but I don't understand the problem for the 2D case.
Not sure I can be much help here--PyOpenCL doesn't do anything
different
in the case of your code than what it does for other codes. It takes
the
source code string and hands it off to the implementation. So this is
looking a bit like an Nvidia problem to me. One way to confirm that
would be to see what you get from a purely C-based code.
You might be able to use this as a starting point:
https://github.com/hpc12/tools
If this fails when trying to build the code -> Nvidia problem.
If this succeeds when trying to build the code -> PyOpenCL problem.
Hope that helps,
Andreas
_______________________________________________
PyOpenCL mailing list
PyOpenCL@tiker.net
https://lists.tiker.net/listinfo/pyopencl