q4os install sycl - Posted on Mar 31, 2024 - See https://software.intel.com/dpcpp - Logs Home - d0010
I will show you how to install dpcpp/cpp sycl c++ compiler on q4os kde linux.
https://software.intel.com/dpcpp
(click Get It Now at that page)
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 sycl c++ dpcpp/cpp.
apt update
apt install intel-oneapi-compiler-dpcpp-cpp
Before installing it, you can search it:
apt search intel-oneapi-compiler-dpcpp-cpp
Write sycl c++ pogram, using dpcpp/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); }
You can use both dpcpp or icpx to compile the code:
dpcpp sycl-prog.cpp -std=c++23 -o sycl-prog
icpx -fsycl sycl-prog.cpp -std=c++23 -o sycl-prog