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

Commit b1b4260

Browse files
Merge pull request #249 from nicolasvasilache/pr/separate-cuda-tests
Separate cuda tests into tests/cuda folder
2 parents d26f79a + 69e85e6 commit b1b4260

14 files changed

+372
-300
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ set(GTEST_LIBS gtest gtest_main)
1111

1212
set(GOOGLE_LIBS ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${GTEST_LIBS})
1313

14-
add_library(tc_test INTERFACE)
15-
target_include_directories(tc_test INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
16-
target_link_libraries(tc_test INTERFACE ${GOOGLE_LIBS})
17-
18-
1914
################################################################################
2015
# Finally, add tests
2116
################################################################################
@@ -27,13 +22,6 @@ add_executable(test_basic test_basic.cc)
2722
add_test(test_basic test_basic)
2823
target_link_libraries(test_basic ${GOOGLE_LIBS} ${ISL_LIBRARIES} ${ATEN_LIBRARIES})
2924

30-
if (WITH_CUDA)
31-
add_executable(test_basic_gpu test_basic_gpu.cc)
32-
set_target_properties(test_basic_gpu PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_CUDA_SDK}" )
33-
add_test(test_basic_gpu test_basic_gpu)
34-
target_link_libraries(test_basic_gpu ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARIES} ${CUDA_NVRTC_LIBRARIES} ${GOOGLE_LIBS} )
35-
endif()
36-
3725
################################################################################
3826
# Core library only tests
3927
################################################################################
@@ -49,42 +37,6 @@ foreach(i ${CORE_TEST_FILES})
4937
target_link_libraries(${i} ${GOOGLE_LIBS} tc_core)
5038
endforeach()
5139

52-
################################################################################
53-
# Core GPU library tests
54-
################################################################################
55-
if (WITH_CUDA)
56-
add_executable(test_autotuner_utility test_autotuner_utility.cc)
57-
add_test(test_autotuner_utility test_autotuner_utility)
58-
target_link_libraries(test_autotuner_utility ${GOOGLE_LIBS} ${ATEN_LIBRARIES} tc_cuda tc_autotuner)
59-
endif()
60-
61-
62-
################################################################################
63-
# ATen execution based test
64-
################################################################################
65-
if (WITH_CUDA)
66-
set(ATEN_TEST_FILES
67-
test_autotuner
68-
test_compilation_cache
69-
test_execution_engine
70-
test_execution_engine_cache
71-
test_execution_engine_db
72-
test_tc_mapper
73-
test_tc_mapper_bugs
74-
test_corner_cases
75-
)
76-
foreach(i ${ATEN_TEST_FILES})
77-
add_executable(${i} ${i}.cc)
78-
add_test(${i} ${i})
79-
target_link_libraries(
80-
${i}
81-
82-
${GOOGLE_LIBS}
83-
${ATEN_LIBRARIES}
84-
tc_autotuner)
85-
endforeach()
86-
endif()
87-
8840
################################################################################
8941
# CPP mapper tests, execution should use ATen C++ API
9042
################################################################################
@@ -123,24 +75,6 @@ if (WITH_TAPIR)
12375
tc_core_cpu tc_lang)
12476
endif()
12577

126-
################################################################################
127-
# TensorComprehensions tests
128-
# No real need for NVCC if we only use NVRTC
129-
# cuda_add_executable(test_matmul test_matmul.cu OPTIONS -std=c++11)
130-
################################################################################
131-
132-
if (WITH_CAFFE2 AND WITH_CUDA)
133-
set(TEST_FILES
134-
test_caffe2
135-
)
136-
137-
foreach(i ${TEST_FILES})
138-
add_executable(${i} ${i}.cc)
139-
add_test(${i} ${i})
140-
target_link_libraries(${i} ${GOOGLE_LIBS} pthread tc_c2)
141-
endforeach()
142-
endif()
143-
14478
################################################################################
14579
# Lang tests
14680
################################################################################
@@ -155,3 +89,7 @@ foreach(i ${TEST_TC_FILES})
15589
add_test(${i} ${i})
15690
target_link_libraries(${i} ${GOOGLE_LIBS} pthread tc_lang)
15791
endforeach()
92+
93+
if (WITH_CUDA)
94+
add_subdirectory(cuda)
95+
endif()

test/cuda/CMakeLists.txt

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