File tree Expand file tree Collapse file tree 8 files changed +150
-0
lines changed Expand file tree Collapse file tree 8 files changed +150
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %T && mkdir -p %T
2
+ // RUN: cd %T
3
+ // RUN: cp %S/input.cmake ./input.cmake
4
+ // RUN: dpct -in-root ./ -out-root out ./input.cmake --rule-file=%S/../../../../tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml --migrate-cmake-script-only --cuda-include-path="%cuda-path/include"
5
+ // RUN: echo "begin" > %T/diff.txt
6
+ // RUN: diff --strip-trailing-cr %S/expected.txt %T/out/input.cmake >> %T/diff.txt
7
+ // RUN: echo "end" >> %T/diff.txt
8
+
9
+ // CHECK: begin
10
+ // CHECK-NEXT: end
Original file line number Diff line number Diff line change
1
+ add_library(culib)
2
+ add_executable(cuexe)
3
+ target_compile_features(culib PUBLIC c_std_11)
4
+ target_compile_features(culib PRIVATE cxx_std_17)
5
+ target_compile_features(culib
6
+ PUBLIC
7
+ cxx_std_17)
8
+
9
+ target_compile_features(culib PUBLIC c_std_17)
10
+ target_compile_features(culib PRIVATE cxx_std_17)
11
+ target_compile_features(culib
12
+ PUBLIC
13
+ cxx_std_17)
14
+
15
+ target_compile_features(cuexe PUBLIC c_std_20)
16
+ target_compile_features(cuexe PRIVATE cxx_std_17)
17
+ target_compile_features(cuexe
18
+ PUBLIC
19
+ cxx_std_17)
20
+
21
+ target_compile_features(cuexe PUBLIC c_std_23)
22
+ target_compile_features(cuexe PRIVATE cxx_std_17)
23
+ target_compile_features(cuexe
24
+ PUBLIC
25
+ cxx_std_17)
Original file line number Diff line number Diff line change
1
+ add_library (culib)
2
+ add_executable (cuexe)
3
+ TARGET_COMPILE_FEATURES (culib PUBLIC c_std_11)
4
+ target_compile_features (culib PRIVATE cxx_std_11)
5
+ target_compile_features (culib
6
+ PUBLIC
7
+ cuda_std_11)
8
+
9
+ TARGET_COMPILE_FEATURES (culib PUBLIC c_std_17)
10
+ target_compile_features (culib PRIVATE cxx_std_17)
11
+ target_compile_features (culib
12
+ PUBLIC
13
+ cuda_std_17)
14
+
15
+ TARGET_COMPILE_FEATURES (cuexe PUBLIC c_std_20)
16
+ target_compile_features (cuexe PRIVATE cxx_std_20)
17
+ target_compile_features (cuexe
18
+ PUBLIC
19
+ cuda_std_20)
20
+
21
+ TARGET_COMPILE_FEATURES (cuexe PUBLIC c_std_23)
22
+ target_compile_features (cuexe PRIVATE cxx_std_23)
23
+ target_compile_features (cuexe
24
+ PUBLIC
25
+ cuda_std_23)
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %T && mkdir -p %T
2
+ // RUN: cd %T
3
+ // RUN: cp %S/input.cmake ./input.cmake
4
+ // RUN: dpct -in-root ./ -out-root out ./input.cmake --rule-file=%S/../../../../tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml --migrate-cmake-script-only --cuda-include-path="%cuda-path/include"
5
+ // RUN: echo "begin" > %T/diff.txt
6
+ // RUN: diff --strip-trailing-cr %S/expected.txt %T/out/input.cmake >> %T/diff.txt
7
+ // RUN: echo "end" >> %T/diff.txt
8
+
9
+ // CHECK: begin
10
+ // CHECK-NEXT: end
Original file line number Diff line number Diff line change
1
+ project(foo-bar LANGUAGES CXX )
2
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl")
3
+ find_program(dpct_bin_path NAMES dpct PATHS)
4
+ get_filename_component(bin_path_of_dpct ${dpct_bin_path} DIRECTORY)
5
+ set(dpct_cmake_file_path "${bin_path_of_dpct}/../cmake/dpct.cmake")
6
+ include(${dpct_cmake_file_path})
7
+
8
+ add_library(culib)
9
+ add_executable(cuexe)
10
+ dpct_add_mkl_to_target(culib)
11
+ dpct_add_mkl_to_target(
12
+ culib
13
+ )
14
+
15
+ dpct_add_mkl_to_target(cuexe)
16
+ dpct_add_mkl_to_target(
17
+ cuexe
18
+ )
Original file line number Diff line number Diff line change
1
+ project (foo-bar LANGUAGES CXX CUDA)
2
+
3
+ add_library (culib)
4
+ add_executable (cuexe)
5
+ CUDA_ADD_CUFFT_TO_TARGET(culib)
6
+ cuda_add_cufft_to_target(
7
+ culib
8
+ )
9
+
10
+ CUDA_ADD_CUFFT_TO_TARGET(cuexe)
11
+ cuda_add_cufft_to_target(
12
+ cuexe
13
+ )
Original file line number Diff line number Diff line change 138
138
In : ${arg}.cu
139
139
Out : ${arg}.dp.cpp
140
140
141
+ - Rule : rule_cuda_add_cufft_to_target
142
+ Kind : CMakeRule
143
+ Priority : Fallback
144
+ CmakeSyntax : cuda_add_cufft_to_target
145
+ MatchMode : Partial
146
+ In : cuda_add_cufft_to_target(${value})
147
+ Out : dpct_add_mkl_to_target(${value})
148
+
149
+ # Current Yaml based rule hard-code to map "cxx_std_xx" to "cxx_std_17"
150
+ # A more flexible mapping logic should be implemented in implicit rules
151
+ - Rule : rule_cxx_target_compile_features
152
+ Kind : CMakeRule
153
+ Priority : Fallback
154
+ CmakeSyntax : cxx_target_compile_features
155
+ MatchMode : Partial
156
+ In : target_compile_features(${value})
157
+ Out : target_compile_features(${value})
158
+ Subrules :
159
+ value :
160
+ In : cxx_std_${ver}
161
+ Out : cxx_std_17
162
+ RuleId : " adjust cxx_ver"
163
+
164
+ # Current Yaml based rule hard-code to map "cuda_std_xx" to "cxx_std_17"
165
+ # A more flexible mapping logic should be implemented in implicit rules
166
+ - Rule : rule_cuda_target_compile_features
167
+ Kind : CMakeRule
168
+ Priority : Fallback
169
+ CmakeSyntax : cuda_target_compile_features
170
+ MatchMode : Partial
171
+ In : target_compile_features(${value})
172
+ Out : target_compile_features(${value})
173
+ Subrules :
174
+ value :
175
+ In : cuda_std_${ver}
176
+ Out : cxx_std_17
177
+ RuleId : " adjust cuda_ver"
178
+
Original file line number Diff line number Diff line change @@ -74,3 +74,14 @@ endmacro()
74
74
macro (DPCT_COMPILE_SYCL_CODE generated_files)
75
75
DPCT_COMPILE_SYCL_CODE_IMP(sycl_device ${generated_files} ${ARGN} )
76
76
endmacro ()
77
+
78
+ # Link MKL library to target
79
+ macro (DPCT_ADD_MKL_TO_TARGET target )
80
+ if (WIN32 )
81
+ target_link_libraries (${target} mkl_sycl_dll.lib mkl_intel_ilp64_dll.lib mkl_tbb_thread_dll.lib mkl_core_dll.lib OpenCL.lib)
82
+ elseif (UNIX AND NOT APPLE )
83
+ target_link_libraries (${target} -L${MKLROOT} /lib/intel64 -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -lOpenCL -lmkl_sycl -lpthread -ldl)
84
+ else ()
85
+ message (FATAL_ERROR "Unsupported platform" )
86
+ endif ()
87
+ endfunction ()
You can’t perform that action at this time.
0 commit comments