Skip to content

Commit 5debda3

Browse files
Lit test for cuda_add_cufft_to_target CMake macro
1 parent 80110d2 commit 5debda3

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 --migrate-cmake-script-only
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
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dpct_add_mkl_to_target(culib)
2+
dpct_add_mkl_to_target(
3+
culib
4+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CUDA_ADD_CUFFT_TO_TARGET(culib)
2+
cuda_add_cufft_to_target(
3+
culib
4+
)

clang/tools/dpct/DpctOptRules/cmake_script_migration_rule.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@
508508
Out: ""
509509
MatchMode: Full
510510
RuleId: "remove_-static-libstdc++"
511+
511512
- Rule: rule_cuda_compile_fatbin
512513
Kind: CMakeRule
513514
Priority: Fallback
@@ -527,3 +528,11 @@
527528
CmakeSyntax: cuda_compile_fatbin_opts
528529
In: dpct_helper_compile_sycl_code(${value} OPTIONS ${options})
529530
Out: dpct_helper_compile_sycl_code(${value})
531+
532+
- Rule: rule_cuda_add_cufft_to_target
533+
Kind: CMakeRule
534+
Priority: Fallback
535+
CmakeSyntax: cuda_add_cufft_to_target
536+
In: cuda_add_cufft_to_target(${target})
537+
Out: dpct_add_mkl_to_target(${target})
538+

clang/tools/dpct/cmake/dpct.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,14 @@ if(WIN32)
9696
else()
9797
set(DNN_LIB "dnnl")
9898
endif()
99+
100+
# Link MKL library to target
101+
macro(DPCT_ADD_MKL_TO_TARGET target)
102+
if(WIN32)
103+
target_link_libraries(${target} mkl_sycl_dll.lib mkl_intel_ilp64_dll.lib mkl_tbb_thread_dll.lib mkl_core_dll.lib OpenCL.lib)
104+
elseif(UNIX AND NOT APPLE)
105+
target_link_libraries(${target} -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -lOpenCL -lmkl_sycl -lpthread -ldl)
106+
else()
107+
message(FATAL_ERROR "Unsupported platform")
108+
endif()
109+
endmacro()

0 commit comments

Comments
 (0)