DPCT3001#
Message#
“<CMake common command>” is used to generate an output file by performing transformation on input file. You may need to update the name of the input and output file, as well as migrate the input file if the input file contains CUDA syntax.
Detailed Help#
“<CMake common command>” is used to generate an output file by performing transformation on input file. You may need to update the name of the input and output file, as well as migrate the input file if the input file contains CUDA syntax.
Suggestions to Fix#
For example, the CMake command configure_file(<input> <output> options) with the “@ONLY” option replaces variables in <input> file that are explicitly marked with “@VAR@” format (see “@FOO_VERSION@” in the example code) with the value of VAR defined in CMake script(see “FOO_VERSION” in the CMake script), and then save out as <output> file.
For example, this original CUDA* code:
1// src/bar.in.cu
2__global__ void hello_kernel() {}
3
4int main() {
5 std::cout << "FOO version: @FOO_VERSION@" << std::endl;
6 hello_kernel<<<1, 1>>>();
7 cudaDeviceSynchronize();
8 return 0;
9}
And the CMake script for the original CUDA* code:
1# src/CMakeLists.txt
2set(FOO_VERSION 1.00)
3
4configure_file(
5 ${CMAKE_SOURCE_DIR}/bar.in.cu
6 ${CMAKE_BINARY_DIR}/bar.cu
7 @ONLY
8)
result in the following migrated SYCL codes:
1// build/bar.dp.cpp
2void hello_kernel() {
3}
4
5int main() {
6 std::cout << "FOO version: 1.00" << std::endl; // Example replacement
7 dpct::get_in_order_queue().parallel_for(
8 sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
9 [=](sycl::nd_item<3> item_ct1) {
10 hello_kernel();
11 });
12 dpct::get_current_device().queues_wait_and_throw();
13 return 0;
14}
1# CMakeLists.txt
2set(FOO_VERSION 1.00)
3DPCT3001:1: "configure_file" is used to generate an output file by performing
4transformation on input file. You may need to update the name of the input and
5output file, as well as migrate the input file if the input file contains CUDA syntax
6configure_file(
7 ${CMAKE_SOURCE_DIR}/bar.in.dp.cpp
8 ${CMAKE_BINARY_DIR}/bar.dp.cpp
9 @ONLY
10)
which need to be rewritten to:
1// src/bar.in.dp.cpp
2void hello_kernel() {
3}
4
5int main() {
6 std::cout << "FOO version: @FOO_VERSION@" << std::endl;
7 dpct::get_in_order_queue().parallel_for(
8 sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
9 [=](sycl::nd_item<3> item_ct1) {
10 hello_kernel();
11 });
12 dpct::get_current_device().queues_wait_and_throw();
13 return 0;
14}
and:
1# src/CMakeLists.txt
2set(FOO_VERSION 1.00)
3configure_file(
4 ${CMAKE_SOURCE_DIR}/bar.in.dp.cpp
5 ${CMAKE_BINARY_DIR}/bar.dp.cpp
6 @ONLY
7)