PrevUpHomeNext

q4os sycl cpp


q4os install sycl - Posted on Mar 31, 2024 - See https://software.intel.com/dpcpp - Logs Home - d0010

q4os kde linux install sycl cpp (dpcpp)

I will show you how to install dpcpp/cpp sycl c++ compiler on q4os kde linux.

Find the dpcpp apt repo

Browse this url to find the link to get sycl:

https://software.intel.com/dpcpp

(click Get It Now at that page)

Select repo

Select operating system: Linux

Select distribution: APT Package Manager

Then you will see how to add the intel software repo to your q4os linux. I am using q4os kde.

Jut follow them and add the repo.

Install dpcpp/cpp

Install sycl c++ dpcpp/cpp.

Update

apt update

Install

apt install intel-oneapi-compiler-dpcpp-cpp

Before installing it, you can search it:

apt search intel-oneapi-compiler-dpcpp-cpp

Write sycl cpp program

Write sycl c++ pogram, using dpcpp/cpp

sycl-prog.cpp

#include <sycl/sycl.hpp>
#include <iostream>

int main()
{
	sycl::queue q{sycl::gpu_selector_v};
	
	float * data = sycl::malloc_shared<float>(37, q);
	
	q.parallel_for(
		37,
		[=] (sycl::item<1> item)
		{
			sycl::id id = item.get_id();
			data[id] = sycl::sqrt<float>(id);
		}
	);
	q.wait();
	for (int i=0; i<37; ++i)
		std::cout << data[i] << ' ';
	std::cout << std::endl;
	
	sycl::free(data, q);
}

Then you can compile and run sycl code

You can use both dpcpp or icpx to compile the code:

Compile with dpcpp :

dpcpp sycl-prog.cpp -std=c++23 -o sycl-prog

Compile with icpx :

icpx -fsycl sycl-prog.cpp -std=c++23 -o sycl-prog

See Also

https://sycl.tech

https://software.intel.com/dpcpp

sycl specification


PrevUpHomeNext