Developer Guide and Reference

  • 2021.2
  • 03/26/2021
  • Public Content

Frequently Asked Questions (FAQ)

This page contains the most frequently asked questions about the Intel® DPC++ Compatibility Tool.

Enabling C++ Features

Question:
How do I enable the Intel® DPC++ Compatibility Tool to migrate source files that are using C++11, or newer C++ standard features (for example
std::declval
) on Linux* and Windows*?
Answer:
On Linux, the default C++ standard for the Intel® DPC++ Compatibility Tool’s parser is C++98, with some C++11 features accepted. If you want to enable other C++11 or newer standard features in the Intel® DPC++ Compatibility Tool, you need to add an option (for example:
--extra-arg="-std=c++11"
to the command line. The supported values are:
  • c++11
  • c++14
  • c++17
On Windows, the default C++ standard for the Intel® DPC++ Compatibility Tool’s parser is C++14. If you want to enable C++17 features in the Intel® DPC++ Compatibility Tool, you need to add the option
--extra-arg="-std=c++17"
to the command line.

Migrating a CMake* Project on Windows

Question:
How do I use the Intel® DPC++ Compatibility Tool to migrate files on Windows when using a CMake project?
Answer:
For a CMake project on a Windows OS, you can use CMake to generate Microsoft Visual Studio* project files (
vcxproj
files). Then:
  • You can migrate the source files in a command line by using the
    --vcxprojfile
    option of the Intel® DPC++ Compatibility Tool
—OR—
  • You can migrate the entire project in Microsoft Visual Studio with an Intel® DPC++ Compatibility Tool Microsoft Visual Studio plugin.

Errors When Migrating a Batch of Files with
dpct --in-root=srcdir --out-root=dstdir *.cu

Question:
Sometimes, when I try to migrate a batch of files with
dpct --in-root=srcdir --out-root=dstdir *.cu
, the Intel® DPC++ Compatibility Tool reports errors such as
error: unknown type name
. How can I fix this issue?
Answer:
The problem may be caused by files in the
*.cu
list, which can be used as header files (included with an
#include
statement) and are not supposed to be parsed as a standalone file. In this case, the Intel® DPC++ Compatibility Tool reports an error if it cannot parse the file because the file depends on the definitions/declarations in other files. Use one of the methods below to migrate your content:
  • Rely on the Intel® DPC++ Compatibility Tool to decide which files to migrate with:
    compile_commands.json: “dpct -p=compile_commands.json --in-root=srcdir --out-root=dstdir”
  • Manually pass specific files to migrate, but do not pass the files that are included in other files and not supposed to be compiled as a standalone file in the original application. The header files are migrated automatically when they are included by the files provided as the input to the tool and are located within the
    in-root
    folder:
    dpct --in-root= srcdir --out-root=dstdir sample.cu

Formatting the Migrated Code

Question:
How does the Intel® DPC++ Compatibility Tool format the migrated code?
Answer:
The Intel® DPC++ Compatibility Tool provides two options:
--format-range
and
--format-style
to control the format of migrated code.
If input source code is well formatted, the Intel® DPC++ Compatibility Tool will use default options settings
--format-range
and
--format-style
to format the resulting code.
If input source code is not well formatted (for example, the tool detects mixed use of tabs and spaces or mixed indents) you can do one of the following:
  • The Intel® DPC++ Compatibility Tool will try to detect the indent size of the original code and apply it to the resulting code. You can guide the tool by setting
    TabWidth
    and
    UseTab
    in
    .clang-format
    file. Because the input source code is not well formatted, the indents in the resulting code may still be inconsistent.
  • Run the Intel® DPC++ Compatibility Tool with the
    --format-range=all
    option to format the entire resulting file. The change between input source code and resulting source code may be large and make it more difficult to compare the code.
  • Format your input source code, then use the Intel® DPC++ Compatibility Tool with the same
    .clang-format
    file for migration.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.