inducer / inducer/pyopencl

A program is not built on a CPU device in a heterogeneous context

Open
#323 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
247
Avg merge
7h 2m
Merged PRs (30d)
6

Description

MacOS 10.15.2, Python 3.7.5, PyOpenCL 2019.1.2

My machine has three available devices:
- 0: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
- 1: Intel(R) UHD Graphics 630
- 2: AMD Radeon Pro Vega 20 Compute Engine

I am running the following code:
```
import pyopencl as cl

platform = cl.get_platforms()[0]
devices = platform.get_devices()
ctx = cl.Context([devices[0], devices[1]])

src = """
__kernel void sum(
__global const float *a_g, __global const float *b_g, __global float *res_g)
{
int gid = get_global_id(0);
res_g[gid] = a_g[gid] + b_g[gid];
}
"""

prg = cl.Program(ctx, src)
prg = prg.build()
for i in range(len(prg.devices)):
print("status for device", prg.devices[i], ": ",
prg.get_build_info(prg.devices[i], cl.program_build_info.STATUS))
print("prg.binaries", prg.binary_sizes)
```

When using devices 0 and 1 for the context (corresponding to the line above `ctx = cl.Context([devices[0], devices[1]])`), I get the following output:
```
status for device : 0
status for device : -2
prg.binaries [2227, 0]
```
That is, the build for the CPU fails (the logs are empty). Same result for devices 0 and 2. For devices 1 and 2 (that is, both GPUs), everything works:
```
status for device : 0
status for device : 0
prg.binaries [2227, 14256]
```

The following [crude OpenCL/C code](https://gist.github.com/fjarri/9e0b9be7f2cabbd7d3ffd03930b25b9f) that (as far as I can tell) attempts to do the same thing, returns success statuses for a context with devices 0 and 1. What can be the reason for the errors in Python?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.