Intel oneAPI DPC++/C++ Compiler is designed for C, C++, and Data Parallel C++ (DPC++) programming on Intel processor-based systems. It supports heterogeneous computing across CPUs, GPUs, and FPGAs, and is part of the Intel oneAPI initiative, which aims to deliver a unified programming model for diverse compute architectures. This tutorial explains how to install Intel oneAPI DPC++/C++ Compiler on Ubuntu.
Install Intel oneAPI DPC++/C++ Compiler
Download the oneAPI GPG key:
sudo wget -qO /etc/apt/trusted.gpg.d/intel-oneapi.asc https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
Add the oneAPI repository:
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/intel-oneapi.list
Update the package lists:
sudo apt update
Install the Intel oneAPI DPC++/C++ Compiler and related tools:
sudo apt install -y intel-oneapi-compiler-dpcpp-cpp
Create a startup script to automatically source Intel's environment setup on login:
echo 'source /opt/intel/oneapi/setvars.sh > /dev/null' | sudo tee -a /etc/profile.d/intel-oneapi.sh
To apply the changes immediately, either log out and log back in, or run the following command:
source /etc/profile
Verify the installation by checking versions:
icx --version
icpx --version
Testing Intel oneAPI DPC++/C++ Compiler
Create a main.c
file:
nano main.c
Add the following code:
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
Compile a code:
icx main.c -o test
Run the program:
./test
Uninstall Intel oneAPI DPC++/C++ Compiler
To fully uninstall the Intel oneAPI DPC++/C++ Compiler and all related dependencies, run the following command:
sudo apt purge --autoremove -y intel-oneapi-compiler-dpcpp-cpp
Delete the intel-oneapi.sh
file, which was used for environment setup:
sudo rm -rf /etc/profile.d/intel-oneapi.sh
Remove GPG key and repository:
sudo rm -rf /etc/apt/trusted.gpg.d/intel-oneapi.asc
sudo rm -rf /etc/apt/sources.list.d/intel-oneapi.list
Leave a Comment
Cancel reply