Basic Migration Options#

The following table lists command line options for basic migration.

Option

Description

--analysis-scope-path=<dir>

The directory path for the analysis scope of the source tree that needs to be migrated. Default: the value of --in-root.

--compilation-database=<dir>

The directory path for the compilation database (compile_commands.json) for the files to be migrated. Paths and build options described in the project file are used to guide the migration.

When no path is specified, a search for compile_commands.json is attempted through all parent directories of the first input source file.

Same as -p.

--cuda-include-path=<dir>

The directory path of the CUDA* header files.

--extra-arg=<string>

Specify additional arguments to append to the migration command line. The option accepts a comma-separated list of extra arguments and may be used multiple times in a command. For example:

dpct xx.cu --extra-arg="-I /path, -I /path2" --extra-arg="-I /path/to/header"

Use the dpct -- -help command to find options that can be passed as extra arguments for the migration command.

--in-root=<dir>

The directory path for the root of the source tree that needs to be migrated. Only files under this root are migrated. Default:

  • The current directory, if the input source files are not provided.

  • The directory of the first input source file, if the input source files are provided.

Details:

  • Any source within the directory specified by --in-root (at any nesting level) may be migrated.

  • Any header file within the directory specified by --in-root (at any nesting level) that is included by the source or header file which is being migrated, is also migrated.

  • Files from outside the --in-root directory will not be migrated even if they are included by any of the program source files.

--in-root-exclude=<dir|file>

Excludes the specified directory or file from processing.

--no-incremental-migration

Tells the tool to not perform an incremental migration. Default: off (incremental migration happens).

--out-root=<dir>

The directory path for root of generated files. A directory is created if it does not exist. Default: dpct_output.

The relative paths for the generated files are maintained. By default, file extensions are changed as follows:

  • *.cu *.dp.cpp

  • *.cpp *.cpp.dp.cpp

  • *.cc *.cc.dp.cpp

  • *.cxx *.cxx.dp.cpp

  • *.C *.C.dp.cpp

  • *.cuh *.dp.hpp

  • *.h *.hpp *.hxx → extensions are kept the same

To limit file extension changes to .cu and .cuh files only, use the --change-cuda-files-extension-only option.

-p

Alias for --compilation-database.

--process-all

Migrates or copies all files, except hidden, from the --in-root directory to the --out-root directory. The --in-root option should be explicitly specified. Default: off.

Details:

If --process-all and --in-root options are specified, but no input files are provided, the tool migrates or copies all files, except hidden, from the --in-root directory to the output directory.

  • If there is a compilation database:

    • Files from the compilation database are migrated with the options specified in the compilation database

    • Files with the .cu extension that are not listed in the compilation database are migrated as standalone

    • Remaining files are copied to the –out-root directory

  • If there is no compilation database:

    • Files with the .cu extension are migrated as standalone

    • Remaining files are copied to the -out-root directory

--process-all is ignored if input files are provided on the command line.

--stop-on-parse-err

Stop migration and generation of reports if parsing errors happened. Default: off.

--vcxprojfile=<file>

The directory path for the C++ project file vcxproj of the Visual Studio project to migrate. Paths and build options described in the project file are used to guide the migration.

--intercept-build

Intercept build tool to generate a compilation database.

--sycl-file-extension=<value>

Specifies the extension of migrated source file(s). The values are:

  • =dp-cpp: Use extension ‘.dp.cpp’ and ‘.dp.hpp’ (default).

  • =sycl-cpp: Use extension ‘.sycl.cpp’ and ‘.sycl.hpp’.

  • =cpp: Use extension ‘.cpp’ and ‘.hpp’.