OpenCL error: undefined reference to `_Z12atom_cmp

2019-08-02 10:02发布

问题:

When compiling the following OpenCL kernel:

#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable

__kernel void kernel(__global ulong* mem) {
    atom_cmpxchg(&mem[0], 0, 1);
}

I get the following error:

error: undefined reference to `_Z12atom_cmpxchgPVU8CLglobalmmm()'

I'm using OpenCL from Rust with the OCL library. My OpenCL version is 1.2, my GPU is an Intel(R) Iris(TM) Graphics 550, I'm under macOS Sierra 10.12.1.

回答1:

Check the CL_DEVICE_EXTENSIONS of your device with clGetDeviceInfo(). cl_khr_int64_base_atomics may not be supported with this GPU under macOS.



标签: rust opencl