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.
Use of the Intel® DPC++ Compatibility Tool will result in a project that is not entirely
migrated. Additional work, as outlined by the output of the Intel® DPC++ Compatibility Tool,
is required to complete the migration.
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, wherex.yis 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.
The CUDA include path should not be the same as, or a child path of, the
directory where the source code that needs to be migrated is located.
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>]
c2s is an alias to the dpct command and may be used in it’s place.
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 theoneapi-cliutility 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 thevector_add.cusample.
- Run the Intel® DPC++ Compatibility Tool from the sample root directory:dpct --in-root=. src/vector_add.cuThevector_add.dp.cppfile should appear in thedpct_outputdirectory. The file is now a SYCL source file.
- Navigate to the new SYCL source file:cd dpct_outputVerify 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 theAddressing Warnings in Migrated Codesection of the README files.To compile the migrated sample, add-I<dpct_root_folder>/includeto 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 |
---|---|
Detailed overview of Intel® DPC++ Compatibility Tool features, workflow, and use. | |
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. |