Get Started with the Intel® DPC++ Compatibility Tool
The Intel® DPC++ Compatibility Tool assists in the migration of a developer’s program that is written in CUDA* to a program written in Data Parallel C++ (DPC++), which is based on modern C++ and incorporates portable industry standards such as SYCL*.
Visit the Intel® DPC++ Compatibility Tool Developer Guide and Reference for additional information about the tool.
Visit the Release Notes for known issues and the most up-to-date information.
Before You Begin
The Intel® DPC++ Compatibility Tool is included in the Intel® oneAPI Base Toolkit. If you have not installed the Intel® oneAPI Base Toolkit, follow the instructions in the Installation Guide.
Certain CUDA header files (specific to your project) may need to be accessible to the Intel® DPC++ Compatibility Tool. The Intel® DPC++ Compatibility Tool looks for these CUDA header files in the default locations:
/usr/local/cuda/include
/usr/local/cuda-x.y/include, where x.y is one of these values: 8.0, 9.x, 10.x, and 11.0–11.6.
You can reference custom locations by pointing to them with the --cuda-include-path=<path/to/cuda/include> option in the Intel® DPC++ Compatibility Tool command line.
Currently, the Intel® DPC++ Compatibility Tool supports the migration of programs implemented with CUDA versions 8.0, 9.x, 10.x, and 11.0–11.6. The list of supported languages and versions may be extended in the future.
To set up the Intel® DPC++ Compatibility Tool environment, run the following:
On Linux (sudo): source /opt/intel/oneapi/setvars.sh
On Linux (user): source ~/intel/oneapi/setvars.sh
On Windows: Drive:\Program Files (x86)\Intel\oneAPI\setvars.bat
The general invocation syntax from the operating system shell is:
dpct [options] [<source0>... <sourceN>]
Built-in Usage Information
To see the list of Intel® DPC++ Compatibility Tool–specific options, use --help:
dpct --help
To see the list of the language parser (Clang*) options, pass -help as the Clang option:
dpct -- -help
Emitted Warnings
The Intel® DPC++ Compatibility Tool identifies the places in the code that may require your attention during the migration of the files in order to make the code SYCL compliant or correct.
Comments are inserted into the generated source files and displayed as warnings in the output. For example:
/path/to/file.hpp:26:1: warning: DPCT1003:0: Migrated API does not return error code. (*,0) is inserted. You may need to rewrite this code. // source code line for which warning was generated ^
For more details on what a specific warning means, refer to the Diagnostic Reference.
Migrate a Simple Test Project
The Intel® DPC++ Compatibility Tool comes with several sample projects so you can explore the tool and familiarize yourself with how it functions:
Sample Project |
Description |
---|---|
Vector Add DPCT
|
The Vector Add DPCT sample demonstrates how to migrate a simple program from CUDA to SYCL. Vector Add provides an easy way to verify that your development environment is setup correctly to use the Intel® DPC++ Compatibility Tool. |
Folder Options DPCT
|
The Folder Options DPCT sample shows how to migrate more complex projects and to use options. |
Rodinia NW DPCT
|
The Rodinia NW DPCT sample demonstrates how to migrate a Make/CMake project from CUDA to SYCL using the Intel® DPC++ Compatibility Tool. |
Review the README file provided with each sample for more detailed information about the purpose and usage of the sample project.
To access the samples
use the oneapi-cli utility to select a sample from the Intel® DPC++ Compatibility Tool category, or
download the samples from GitHub*.
For more detailed information on how to download and access the samples, visit the Intel® oneAPI Base Toolkit Get Started Guides:
Try a Sample Project
Follow these steps to migrate the Vector Add DPCT sample project using the Intel® DPC++ Compatibility Tool:
Download the vector_add.cu sample.
Run the Intel® DPC++ Compatibility Tool from the sample root directory:
dpct --in-root=. src/vector_add.cu
The vector_add.dp.cpp file should appear in the dpct_output directory. The file is now a SYCL source file.
Navigate to the new SYCL source file:
cd dpct_output
Verify the generated source code and fix any code that the Intel® DPC++ Compatibility Tool was unable to migrate. (The code used in this example is simple, so manual changes may not be needed). For the most accurate and detailed instructions on addressing warnings emitted from the Intel® DPC++ Compatibility Tool, see the Addressing Warnings in Migrated Code section of the README files.
NOTE:To compile the migrated sample, add -I<dpct_root_folder>/include to your compile command.
For more complex sample instructions, see the Migrate a Project section of the Intel® DPC++ Compatibility Tool Developer Guide and Reference.
Find More
Content |
Description |
---|---|
Intel® DPC++ Compatibility Tool Developer Guide and Reference |
Detailed overview of Intel® DPC++ Compatibility Tool features, workflow, and use. |
On-Demand Webinar: Migrating Your Existing CUDA Code to DPC++ Code |
How to migrate CUDA code to Data Parallel C++ (DPC++) using the Intel® DPC++ Compatibility Tool, a one-time migration engine that ports both kernels and API calls. |
Detailed instructions on how to get and install Intel® oneAPI packages using different installer modes and package managers. |
|
The SYCL Specification PDF. Explains how SYCL integrates OpenCL devices with modern C++. |
|
The SYCL 2020 Specification PDF. |
|
An overview of SYCL provided by the Khronos Group. |
|
Description of CUDA support in clang. |
|
Proposed extensions to the SYCL specification. |
|
Add oneAPI components to a Yocto project build using the meta-intel layers. |