File: CMakeLists.txt

package info (click to toggle)
pytorch 1.13.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 139,252 kB
  • sloc: cpp: 1,100,274; python: 706,454; ansic: 83,052; asm: 7,618; java: 3,273; sh: 2,841; javascript: 612; makefile: 323; xml: 269; ruby: 185; yacc: 144; objc: 68; lex: 44
file content (58 lines) | stat: -rw-r--r-- 1,653 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set(LAZY_TEST_ROOT ${TORCH_ROOT}/test/cpp/lazy)

# Build the cpp gtest binary containing the cpp-only tests.
set(LAZY_TEST_SRCS
  ${LAZY_TEST_ROOT}/test_backend_device.cpp
  ${LAZY_TEST_ROOT}/test_cache.cpp
  ${LAZY_TEST_ROOT}/test_ir.cpp
  ${LAZY_TEST_ROOT}/test_ir_util.cpp
  ${LAZY_TEST_ROOT}/test_misc.cpp
  ${LAZY_TEST_ROOT}/test_permutation_util.cpp
  ${LAZY_TEST_ROOT}/test_shape.cpp
  ${LAZY_TEST_ROOT}/test_trie_cache.cpp
  ${LAZY_TEST_ROOT}/test_util.cpp
)
if(BUILD_LAZY_TS_BACKEND)
    list(APPEND LAZY_TEST_SRCS
      ${LAZY_TEST_ROOT}/test_lazy_ops.cpp
      ${LAZY_TEST_ROOT}/test_lazy_ops_util.cpp
    )
endif()

add_executable(test_lazy
  ${TORCH_ROOT}/test/cpp/common/main.cpp
  ${LAZY_TEST_SRCS}
)

# TODO temporary until we can delete the old gtest polyfills.
target_compile_definitions(test_lazy PRIVATE USE_GTEST)

set(LAZY_TEST_DEPENDENCIES torch gtest)

target_link_libraries(test_lazy PRIVATE ${LAZY_TEST_DEPENDENCIES})
target_include_directories(test_lazy PRIVATE ${ATen_CPU_INCLUDE})

if(USE_CUDA)
  target_link_libraries(test_lazy PRIVATE
    ${CUDA_LIBRARIES}
    ${CUDA_NVRTC_LIB}
    ${CUDA_CUDA_LIB}
    ${TORCH_CUDA_LIBRARIES})

  target_compile_definitions(test_lazy PRIVATE USE_CUDA)
elseif(USE_ROCM)
  target_link_libraries(test_lazy PRIVATE
    ${ROCM_HIPRTC_LIB}
    ${PYTORCH_HIP_HCC_LIBRARIES}
    ${TORCH_CUDA_LIBRARIES})

  target_compile_definitions(test_lazy PRIVATE USE_ROCM)
endif()

if(INSTALL_TEST)
  install(TARGETS test_lazy DESTINATION bin)
  # Install PDB files for MSVC builds
  if(MSVC AND BUILD_SHARED_LIBS)
    install(FILES $<TARGET_PDB_FILE:test_lazy> DESTINATION bin OPTIONAL)
  endif()
endif()