Get Started with the Intel® DPC++ Compatibility Tool
The
Intel®
assists in the migration of a developer's program that is written in CUDA* to a program written in
DPC++
Compatibility ToolData Parallel C++ (
, which is based on modern C++ and incorporates portable industry standards such as SYCL*.
DPC++
)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®
is included in the
DPC++
Compatibility ToolIntel® 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®
. The
DPC++
Compatibility ToolIntel®
looks for these CUDA header files in the default locations:
DPC++
Compatibility Tool- /usr/local/cuda/include
- /usr/local/cuda-x.y/include, where x.y is one of these values: 8.0, 9.0, 9.1, 9.2, 10.0, 10.1, 10.2, 11.0 or 11.1.
You can reference custom locations by pointing to them with the
--cuda-include-path=<path/to/cuda/include>
option in the
Intel®
command line.
DPC++
Compatibility ToolThe 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®
supports the migration of programs implemented with CUDA versions 8.0, 9.0, 9.1, 9.2, 10.0, 10.1, 10.2, 11.0, or 11.1. The list of supported languages and versions may be extended in the future.
DPC++
Compatibility Tool To setup the
Intel®
environment, run:
DPC++
Compatibility Tool- On Linux (sudo):source /opt/intel/inteloneapi/setvars.sh
- On Linux (user):source ~/intel/inteloneapi/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 the
Intel®
specific options, use the
DPC++
Compatibility Tool--help
option:
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 notes the places in the code that may require your attention during the migration of the files in order to make the code DPC++ compliant or correct. Comments are inserted into the generated source files and displayed as warnings in the output. For more details on what a particular warning means, see the
Diagnostic Reference. An example is below:
/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
^
Migrate a Simple Test Project
The Intel DPC++ Compatibility Tool comes with several different samples to allow you to explore the tool and familiarize yourself with how it functions. The samples are outlined in the table below.
Access the samples in one of the following ways, then navigate to the root of the sample project:
- Use the oneapi-cli utility to select a sample from the Intel® DPC++ Compatibility Tool category.
- Download from GitHub*: https://github.com/oneapi-src/oneAPI-samples/tree/master/Tools/Migration
For more detailed information on how to download and access the samples, visit the Intel® oneAPI Base Toolkit Get Started Guides:
For more detailed information on the purpose and usage of the test samples, locate the README file provided for each sample.
Test Samples
| Description
|
---|---|
Vector Add DPCT
| This sample demonstrates how to migrate a simple program from CUDA to Data Parallel C++. Vector Add provides an easy way to verify that your development environment is setup correctly to use the Intel® DPC++ Compatibility Tool (dpct).
|
Folder Options DPCT
| This sample provides an example of how to migrate more complex projects and use options.
|
Rodinia NW DPCT
| This sample demonstrates how to migrate a Make/CMake project from CUDA to Data Parallel C++ using the Intel® DPC++ Compatibility Tool.
|
Example
The example provided uses the Vector Add sample.
Basic Invocation on the Command Line
Use the steps below to migrate the Vector Add DPCT sample.
- Download thevector_add.cusample.
- Run theIntel®from the sample root directory:DPC++Compatibility Tool
Thedpct --in-root=. src/vector_add.cuvector_add.dp.cppfile should appear in thedpct_outputdirectory. Use:
The file is now acd dpct_outputsource file.DPC++ - Verify the generated source code and fix the code that theIntel®was unable to migrate. (The code used in this example is simple. In this instance, manual changes may not be needed). For the most accurate and detailed instructions on addressing warnings, see theDPC++Compatibility ToolAddressing Warnings in the Migrated Codesection of the README files: https://github.com/oneapi-src/oneAPI-samples/tree/master/Tools/Migration.For more complex sample instructions, see the Migrate a Project section of theYou must add-I<dpct_root_folder>/includefor the compilation of the migrated sample.Intel®Developer Guide and Reference's.DPC++Compatibility Tool
Find More
Content
| Description and Links
|
---|---|
Intel® Developer Guide and Reference
DPC++ Compatibility Tool | |
On-Demand Webinar: Migrating Your Existing CUDA Code to DPC++ Code
| |
Installation Guides for Intel® oneAPI Toolkits
| |
SYCL specification version 1.2.1 PDF
| |
Khronos* SYCL overview site
| An overview of SYCL:
https://www.khronos.org/sycl/ |
CUDA support in Clang
| |
Proposed extensions to the SYCL specification
|
Notices and Disclaimers
Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.
No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.
The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.