Skip to content

Commit a72ee1b

Browse files
Lit test for cuda_add_cufft_to_target CMake macro
1 parent cc9f3e4 commit a72ee1b

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,11 @@
264264
CmakeSyntax: add_executable_opts
265265
In: add_executable(${value} OPTIONS ${options})
266266
Out: add_executable(${value})
267+
268+
- Rule: rule_cuda_add_cufft_to_target
269+
Kind: CMakeRule
270+
Priority: Fallback
271+
CmakeSyntax: cuda_add_cufft_to_target
272+
In: cuda_add_cufft_to_target(${target})
273+
Out: dpct_add_mkl_to_target(${target})
274+

clang/tools/dpct/cmake/dpct.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,14 @@ endmacro()
7878
# Always set SYCL_HAS_FP16 to true to assume SYCL device to support float16
7979
message("dpct.cmake: SYCL_HAS_FP16 is set true by default.")
8080
set(SYCL_HAS_FP16 TRUE)
81+
82+
# Link MKL library to target
83+
macro(DPCT_ADD_MKL_TO_TARGET target)
84+
if(WIN32)
85+
target_link_libraries(${target} mkl_sycl_dll.lib mkl_intel_ilp64_dll.lib mkl_tbb_thread_dll.lib mkl_core_dll.lib OpenCL.lib)
86+
elseif(UNIX AND NOT APPLE)
87+
target_link_libraries(${target} -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_tbb_thread -lmkl_core -lOpenCL -lmkl_sycl -lpthread -ldl)
88+
else()
89+
message(FATAL_ERROR "Unsupported platform")
90+
endif()
91+
endmacro()

0 commit comments

Comments
 (0)