Skip To Main Content
Intel logo - Return to the home page
My Tools

Select Your Language

  • Bahasa Indonesia
  • Deutsch
  • English
  • Español
  • Français
  • Português
  • Tiếng Việt
  • ไทย
  • 한국어
  • 日本語
  • 简体中文
  • 繁體中文
Sign In to access restricted content

Using Intel.com Search

You can easily search the entire Intel.com site in several ways.

  • Brand Name: Core i9
  • Document Number: 123456
  • Code Name: Emerald Rapids
  • Special Operators: “Ice Lake”, Ice AND Lake, Ice OR Lake, Ice*

Quick Links

You can also try the quick links below to see results for most popular searches.

  • Product Information
  • Support
  • Drivers & Software

Recent Searches

Sign In to access restricted content

Advanced Search

Only search in

Sign in to access restricted content.

The browser version you are using is not recommended for this site.
Please consider upgrading to the latest version of your browser by clicking one of the following links.

  • Safari
  • Chrome
  • Edge
  • Firefox

Workflow for a CUDA* to SYCL* Migration

Overview

Use this basic workflow to migrate your entire code base for CUDA* applications to SYCL* and optimize the code for Intel® GPU kernels.

Target Audience

Software developers with CUDA software development background. 

Prerequisites

The Intel® Tiber™ AI Cloud provides access to a virtual sandbox with access to Intel CPUs and GPUs as well as Intel software developer tools, such as the Intel® oneAPI Base Toolkit (Base Kit).

Alternatively, to use a local development system, you must have access to the following:

  • An Intel GPU. For developer guidance and best practices see the oneAPI GPU Optimization Guide.
  • The Base Kit, which provides core tools and libraries to develop high-performance applications across diverse architectures.
  • The Intel® DPC++ Compatibility Tool, which is available as a stand-alone component or as part of the Base Kit. The Intel DPC++ Compatibility Tool provides guided CUDA to SYCL source code migration.
     

For a complete set of migration resources, see Migrate from CUDA to C++ with SYCL. 

Migration Workflow

Step 1: Decide How to Migrate Your CUDA Sources

Step 2: Migrate Your Code

Step 3: Optimize for Hardware Targets

 

Step 1: Decide How to Migrate Your CUDA Sources

Back to Top

To port your source code to C++ with SYCL, ensure you have a working CUDA application. You can migrate your CUDA sources by either:

  • Auto-generating most of the SYCL code using the Intel DPC++ Compatibility Tool, which provides a side-by-side comparison of CUDA to SYCL code.

    See a Migration Example
  • Manually analyzing CUDA sources and replacing all specific CUDA calls with the equivalent SYCL calls.

The Intel DPC++ Compatibility Tool usually migrates 90%-95% of the code and generates warnings for code regions that need manual intervention to complete the migration.1

This tool uses helper functions defined in the <dpct/dpct.hpp> header file. This is due to some SYCL calls being wrapped in an extra layer to aid the dpct helper functions. The manually migrated SYCL code uses SYCL calls and syntax that map directly to CUDA calls.

Download and try a migration using the simple Vector Add sample.

1 Intel estimates are as of September 2021 and based on measurements on a set of 70 HPC benchmarks and samples, with examples such as Rodinia, Scalable Heterogeneous Computing (SHOC), and Pennant. Results may vary.

Step 2: Migrate Your Code

Back to Top

In this step, migrate your source code to SYCL using a manual or assisted method. After finishing the migration, continue your development work on the SYCL source code.

Assisted Migration

Migrate existing CUDA code to SYCL using the Intel DPC++ Compatibility Tool. The tool ports CUDA language kernels and library API calls, and migrates most of the CUDA code to architecture- and vendor-portable SYCL code.

 

Learn with a Code Sample

To become familiar with the migration process for your CUDA sources, use the following resources:

  • Guide to migrating a Jacobi sample: CUDA to SYCL Migration–Jacobi Iterative Method.
    This guide provides a detailed step-by-step analysis of the migration with explicit explanations of the migration process and CUDA to SYCL mappings.
  • Additional background and the associated source code for the ported examples using the Intel DPC++ Compatibility Tool as well as additional migration and optimization techniques are on GitHub*.

   

Manual Migration

The manually migrated SYCL code uses SYCL calls and syntax that directly map to CUDA calls. This approach produces cleaner migrated code that may be easier to maintain in the long term. The code functionality between the two is nearly identical. 

For technical details between CUDA and SYCL mappings using the Jacobi sample, see the instructions in the CUDA to SYCL Migration–Jacobi Iterative Method. This guide explains the underlying concepts of CUDA and SYCL, and the essential terms for migrating the code.

Although there are common steps for offloading and setting up asynchronous streams and memory allocation and copy, the actual work happens in the offload computation. CUDA and SYCL share some basic concepts about creating offload kernels that run on a GPU. To efficiently understand the SYCL syntax, map many of these concepts by identifying the similarities and differences:

  • CUDA thread block and SYCL work group
  • Shared local memory (SLM) access
  • CUDA thread block and SYCL barrier synchronization
  • CUDA cooperative group and SYCL subgroup
  • CUDA warp primitives and SYCL group algorithms
  • CUDA and SYCL atomics

Resources

  • Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference
  • SYCL 2020 Specification

 

   

Step 3: Optimize for Hardware Targets

Back to Top

At this stage, you have working code that compiles and runs. Optimize the migrated code for Intel GPUs using Intel® tools such as Intel® VTune™ Profiler and Intel® Advisor. These tools help identify areas of code to improve for optimizing your application performance. Both tools include graphical user interfaces to help visualize your optimization strategy.

Performance Analysis with Intel® VTune™ Profiler

Use this profiler to create a snapshot of your application performance baseline and identify focus areas for further analysis.

Follow these steps:

  1. Set up your system for GPU analysis.
  2. Launch the Intel VTune Profiler command-line interface.
  3. Run the Performance Snapshot analysis.
  4. View the results.

Roofline Analysis with Intel® Advisor

Use this tool to measure the actual performance of offloaded code using the GPU Roofline Insights analysis. You can evaluate GPU code to see how close the performance is to hardware maximums.

Follow these steps:

  1. Set up your environment to analyze GPU kernels.
  2. Run Roofline Analysis.
  3. Review results to evaluate throughput based on hardware models.

Note For more information on the Jacobi sample, on GitHub, see the "Optimizations" section in Guided Jacobi CUDA Graphs SYCL Migration. The output of these optimization steps is in sycl_migrated_optimized.

Resources

  • Optimize Your GPU Application with the Base Kit
  • oneAPI GPU Optimization Guide
  • Essentials of SYCL for Intel Tiber AI Cloud (Training)

 

  • Company Overview
  • Contact Intel
  • Newsroom
  • Investors
  • Careers
  • Corporate Responsibility
  • Inclusion
  • Public Policy
  • © Intel Corporation
  • Terms of Use
  • *Trademarks
  • Cookies
  • Privacy
  • Supply Chain Transparency
  • Site Map
  • Recycling
  • Your Privacy Choices California Consumer Privacy Act (CCPA) Opt-Out Icon
  • Notice at Collection

Intel technologies may require enabled hardware, software or service activation. // No product or component can be absolutely secure. // Your costs and results may vary. // Performance varies by use, configuration, and other factors. Learn more at intel.com/performanceindex. // See our complete legal Notices and Disclaimers. // Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See Intel’s Global Human Rights Principles. Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.

Intel Footer Logo