Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit a4bc28a

Browse files
Separate cuda tests into test/cuda folder
This changeset moves the cuda-specific tests into the test/cuda folder and is useful for simplifying dependencies in our internal build system.
1 parent ba87609 commit a4bc28a

13 files changed

+75
-61
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ add_executable(test_basic test_basic.cc)
2222
add_test(test_basic test_basic)
2323
target_link_libraries(test_basic ${GOOGLE_LIBS} ${ISL_LIBRARIES} ${ATEN_LIBRARIES})
2424

25-
if (WITH_CUDA)
26-
add_executable(test_basic_gpu test_basic_gpu.cc)
27-
set_target_properties(test_basic_gpu PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_CUDA_SDK}" )
28-
add_test(test_basic_gpu test_basic_gpu)
29-
target_link_libraries(test_basic_gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARIES} ${CUDA_NVRTC_LIBRARIES} ${GOOGLE_LIBS} )
30-
endif()
31-
3225
################################################################################
3326
# Core library only tests
3427
################################################################################
@@ -44,42 +37,6 @@ foreach(i ${CORE_TEST_FILES})
4437
target_link_libraries(${i} ${GOOGLE_LIBS} tc_core)
4538
endforeach()
4639

47-
################################################################################
48-
# Core GPU library tests
49-
################################################################################
50-
if (WITH_CUDA)
51-
add_executable(test_autotuner_utility test_autotuner_utility.cc)
52-
add_test(test_autotuner_utility test_autotuner_utility)
53-
target_link_libraries(test_autotuner_utility ${GOOGLE_LIBS} ${ATEN_LIBRARIES} tc_cuda tc_autotuner)
54-
endif()
55-
56-
57-
################################################################################
58-
# ATen execution based test
59-
################################################################################
60-
if (WITH_CUDA)
61-
set(ATEN_TEST_FILES
62-
test_autotuner
63-
test_compilation_cache
64-
test_execution_engine
65-
test_execution_engine_cache
66-
test_execution_engine_db
67-
test_tc_mapper
68-
test_tc_mapper_bugs
69-
test_corner_cases
70-
)
71-
foreach(i ${ATEN_TEST_FILES})
72-
add_executable(${i} ${i}.cc)
73-
add_test(${i} ${i})
74-
target_link_libraries(
75-
${i}
76-
77-
${GOOGLE_LIBS}
78-
${ATEN_LIBRARIES}
79-
tc_autotuner)
80-
endforeach()
81-
endif()
82-
8340
################################################################################
8441
# CPP mapper tests, execution should use ATen C++ API
8542
################################################################################
@@ -118,24 +75,6 @@ if (WITH_TAPIR)
11875
tc_core_cpu tc_lang)
11976
endif()
12077

121-
################################################################################
122-
# TensorComprehensions tests
123-
# No real need for NVCC if we only use NVRTC
124-
# cuda_add_executable(test_matmul test_matmul.cu OPTIONS -std=c++11)
125-
################################################################################
126-
127-
if (WITH_CAFFE2 AND WITH_CUDA)
128-
set(TEST_FILES
129-
test_caffe2
130-
)
131-
132-
foreach(i ${TEST_FILES})
133-
add_executable(${i} ${i}.cc)
134-
add_test(${i} ${i})
135-
target_link_libraries(${i} ${GOOGLE_LIBS} pthread tc_c2)
136-
endforeach()
137-
endif()
138-
13978
################################################################################
14079
# Lang tests
14180
################################################################################
@@ -150,3 +89,7 @@ foreach(i ${TEST_TC_FILES})
15089
add_test(${i} ${i})
15190
target_link_libraries(${i} ${GOOGLE_LIBS} pthread tc_lang)
15291
endforeach()
92+
93+
if (WITH_CUDA)
94+
add_subdirectory(cuda)
95+
endif()

test/cuda/CMakeLists.txt

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
include_directories(.)
2+
3+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
4+
5+
################################################################################
6+
# Don't ask ... TODO: cleanup gtest
7+
################################################################################
8+
include_directories(${PROJECT_SOURCE_DIR}/third-party/googletest/googletest/include)
9+
set(GTEST_LIBS gtest gtest_main)
10+
11+
set(GOOGLE_LIBS ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${GTEST_LIBS})
12+
13+
################################################################################
14+
# Finally, add tests
15+
################################################################################
16+
17+
################################################################################
18+
# Basic tests of external functionalities we rely upon
19+
################################################################################
20+
add_executable(test_basic_gpu test_basic_gpu.cc)
21+
set_target_properties(test_basic_gpu PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_CUDA_SDK}" )
22+
add_test(test_basic_gpu test_basic_gpu)
23+
target_link_libraries(test_basic_gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARIES} ${CUDA_NVRTC_LIBRARIES} ${GOOGLE_LIBS} )
24+
25+
################################################################################
26+
# Core GPU library tests
27+
################################################################################
28+
add_executable(test_autotuner_utility test_autotuner_utility.cc)
29+
add_test(test_autotuner_utility test_autotuner_utility)
30+
target_link_libraries(test_autotuner_utility ${GOOGLE_LIBS} ${ATEN_LIBRARIES} tc_cuda tc_autotuner)
31+
32+
################################################################################
33+
# ATen execution based test
34+
################################################################################
35+
set(ATEN_TEST_FILES
36+
test_autotuner
37+
test_compilation_cache
38+
test_execution_engine
39+
test_execution_engine_cache
40+
test_execution_engine_db
41+
test_tc_mapper
42+
test_tc_mapper_bugs
43+
test_corner_cases
44+
)
45+
foreach(i ${ATEN_TEST_FILES})
46+
add_executable(${i} ${i}.cc)
47+
add_test(${i} ${i})
48+
target_link_libraries(
49+
${i}
50+
51+
${GOOGLE_LIBS}
52+
${ATEN_LIBRARIES}
53+
tc_autotuner)
54+
endforeach()
55+
56+
################################################################################
57+
# TensorComprehensions tests
58+
# No real need for NVCC if we only use NVRTC
59+
# cuda_add_executable(test_matmul test_matmul.cu OPTIONS -std=c++11)
60+
################################################################################
61+
if (WITH_CAFFE2)
62+
set(TEST_FILES
63+
test_caffe2
64+
)
65+
66+
foreach(i ${TEST_FILES})
67+
add_executable(${i} ${i}.cc)
68+
add_test(${i} ${i})
69+
target_link_libraries(${i} ${GOOGLE_LIBS} pthread tc_c2)
70+
endforeach()
71+
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)