intel DPC++ Compatibility Tool User Guide

June 9, 2024
Intel

intel DPC++ Compatibility Tool

intel DPC++ Compatibility Tool

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.

NOTE 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, 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.

NOTE 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] []

NOTE 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.

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

  • vector_add.cu

| 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

  • main.cu
  • bar/util.cu
  • bar/util.h

| The Folder Options DPCT sample shows how to migrate more complex projects and to use options.
Rodinia NW DPCT

  • needle.cu
  • needle.h
  • needle_kernel.cu

| 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:

  1. Download the vector_add.cu sample.
  2. 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 SYCLsource file.

  1. 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/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.
Installation Guides for Intel®

oneAPI Toolkits

| Detailed instructions on how to get and install Intel® oneAPI packages using different installer modes and package managers.
SYCL specification version

1.2.1 PDF

| The SYCL Specification PDF. Explains how SYCL integrates OpenCL devices with modern C++.
SYCL 2020 Specification| The SYCL 2020 Specification PDF.
Khronos* SYCL overview| An overview of SYCL provided by the Khronos Group.
Compiling CUDA with clang| Description of CUDA support in clang.
Intel LLVM SYCL extensions| Proposed extensions to the SYCL specification.
Layers for Yocto* Project| Add one API components to a Yocto project build using the meta-intel layers.

intel  Logo

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Related Manuals