ComputeCpp availability on Ubuntu 18.04

#1

Is there any chance to get the ComputeCpp working under Ubuntu 18.04? I’ve installed all Intel OCL stuff. The clinfo returns two devices, the CPU and GPU, the `computecpp_info returns two devices too

GLIBC version: 2.27
GLIBCXX: 20160609
This version of libstdc++ is supported.

Device Info:

Discovered 2 devices matching:
platform :
device type :

Device 0:

Device is supported : UNTESTED - Untested OS
CL_DEVICE_NAME : Intel® Gen9 HD Graphics NEO
CL_DEVICE_VENDOR : Intel® Corporation
CL_DRIVER_VERSION : 19.16.12873
CL_DEVICE_TYPE : CL_DEVICE_TYPE_GPU

Device 1:

Device is supported : UNTESTED - Untested OS
CL_DEVICE_NAME : Intel® Xeon® CPU E3-1505M v6 @ 3.00GHz
CL_DEVICE_VENDOR : Intel® Corporation
CL_DRIVER_VERSION : 18.1.0.0920
CL_DEVICE_TYPE : CL_DEVICE_TYPE_CPU

Looks like Untested OS is worth giving it a shot.
then I ran the HelloSYCL example.
The code as following:

    sycl::float4 a = {1.0, 2.0, 3.0, 4.0};
	sycl::float4 b = {4.0, 3.0, 2.0, 1.0};
	sycl::float4 c = {0.0, 0.0, 0.0, 0.0};

	sycl::cpu_selector device_selector;

	sycl::queue queue(device_selector);
	std::cout << "Running on "
			  << queue.get_device().get_info<sycl::info::device::name>() << "\n";

	sycl::buffer<sycl::float4, 1> a_sycl(&a, sycl::range<1>(1));
	sycl::buffer<sycl::float4, 1> b_sycl(&b, sycl::range<1>(1));
	sycl::buffer<sycl::float4, 1> c_sycl(&c, sycl::range<1>(1));

	queue.submit([&](sycl::handler& cgh) {
		auto a_acc = a_sycl.get_access<sycl::access::mode::read>(cgh);
		auto b_acc = b_sycl.get_access<sycl::access::mode::read>(cgh);
		auto c_acc = c_sycl.get_access<sycl::access::mode::discard_write>(cgh);

		cgh.single_task<class vector_addition>(
			[=]() { c_acc[0] = a_acc[0] + b_acc[0]; });
	});

which fails in submitting the kernel, in create_program_for_kernel when checking if (detail::kernel_info<kernelT>::name == nullptr && !c.is_host())

Is there anything that can be easily fixed to get it working?

#2

Hi kreuzerkrieg,

I’m using 18.04 as my daily development machine, and I’m not experiencing any problems. The 16.04 in the name really refers to an older configuration where we had to be careful about mixing GCC versions due to some ABI changes. It’s not an issue when moving between 16.04 and 18.04. In fact, I’m using the same drivers you are (almost, I think we’re slightly behind on the Intel Compute Runtime driver).

How are you compiling this program? Are you using the FindComputeCpp.cmake module distributed with the Compute Cpp SDK?

#3

nope. Regular CMake from CLion. Did I missed something from Getting started stuff?
Will check it right away

#4

I dont see any section stating I must use CMake distributed with Compute Cpp
My CLion is the latest version, so it should be CMake 3.13

Update. I think I better start from cloning the github repo :slight_smile:

Update2. Ok, after adding CMake modules everything works as expected. Thanks!

#5

Hi kreuzerkrieg,

Indeed, there is a separate device compilation stage that happens before the host compilation phase, this is how your code will run on the GPU (or other device). There is an integration guide on our website that hopefully will explain more. The easy way is to use either the -sycl-driver flag or to use the add_sycl_to_target function in the FindComputeCpp.cmake module.

Best,
Duncan.

#6

oh, now I see… of course I didn’t get to this section :slight_smile: Maybe it is worth moving it closer to the Getting started in the TOC to mark its importance of doing first steps. Thanks again, now, the only thing left to do is to start writing something useful :slight_smile:

1 Like