Tool Setup and Basic Use#

Before You Begin#

Install and set up SYCLomatic.

Refer to Get Started with SYCLomatic for installation and setup information.

Basic Use#

You can run SYCLomatic from the command line and provide migration instructions using the tool’s command-line options. The general command syntax is:

dpct [options] [<source0>... <sourceN>]

Note

c2s is an alias to the dpct command and may be used in its place.

If no directory or file is specified for migration, the tool will try to migrate source files found in the current directory. The default output directory is dpct_output. Use the --out-root option to specify an alternate output directory.

You can specify the file path for source files that should be migrated. If using a compilation database, you can find your source code paths in the compilation database file.

The Folder Options sample shows an example of specifying a directory for migration and a specific output folder. For example:

Linux

dpct --in-root=foo --out-root=result/foo foo/main.cu foo/bar/util.cu

Windows

dpct --in-root=foo --out-root=result\foo foo\main.cu foo\bar\util.cu

For detailed instructions on how to use the Folder Options sample, refer to the sample README.

Use Make/CMake* to Migrate a Complete Project on Linux*#

If your project uses Make or CMake, you can use a compilation database to provide compilation options, settings, macro definitions, and include paths to SYCLomatic. For example:

dpct --compilation-database=compile_commands.json --in-root=. --out-root=migration

SYCLomatic parses the compilation database and applies the necessary options when migrating the input sources. Refer to Generate a Compilation Database for detailed information about generating a compilation database.

The Needleman-Wunsch Sample shows an example of migrating a Make/CMake project, using a compilation database to provide project details to the tool.

For detailed instructions on how to use the Needleman-Wunsch sample, refer to the sample README.

Code Samples#

Use the SYCLomatic code samples to get familiar with the migration process and tool features.

Each sample README provides detailed instructions for how to migrate the sample code.

Sample Project

Description

Vector Add

The Vector Add sample shows how to migrate a simple program from CUDA* to SYCL*. You can use this sample to verify that your development environment is set up correctly to use SYCLomatic.

Folder Options

The Folder Options sample shows how to migrate more complex projects and use tool options.

Rodinia Needleman-Wunsch

The Rodinia Needleman-Wunsch sample demonstrates how to migrate a Make/CMake* project from CUDA to SYCL.

Explore the complete list of oneAPI code samples in the oneAPI Samples Catalog (GitHub). These samples were designed to help you develop, offload, and optimize multiarchitecture applications targeting CPUs, GPUs, and FPGAs.

All samples are available on GitHub*.