Skip to content

Cython extension cimporting dpctl fails to compile in C #585

Closed
@oleksandr-pavlyk

Description

@oleksandr-pavlyk

A simple Cython extension that involved cimport dpctl translated to C can not be compiled.

# File: a.pyx
# cython: language=c
# cython: language_level=3

cimport dpctl as c_dpctl
import dpctl

def foo(c_dpctl.SyclQueue q):
    return q.sycl_device.max_compute_unit

Then execute cythonize a.pyx to produce a.c. Compile the file using

gcc -fmax-errors=1 a.c -I$(python -c "import dpctl; print(dpctl.get_include())") -I$(python3-config --includes)

This results in a compilation error due to undefined type bool:

In file included from a.c:638:
/localdisk/repos/dpctl/dpctl/include/dpctl_sycl_device_interface.h:99:1: error: unknown type name ‘bool’
   99 | bool DPCTLDevice_IsAccelerator(__dpctl_keep const DPCTLSyclDeviceRef DRef);
      | ^~~~
compilation terminated due to -fmax-errors=1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions