[PATCH] D27728: [test-suite, CUDA] Added targets for running simple CUDA tests.
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 13:32:32 PST 2016
tra created this revision.
tra added a reviewer: MatzeB.
tra added a subscriber: llvm-commits.
Herald added subscribers: jlebar, mgorny.
`ninja check-cuda-simple` will build cuda-tests-simple and will run them one variant at a time.
Individual variant of the tests can be checked with `ninja check-cuda-simple-<variant>`.
Detection of lit command in the top-level CMakeLists.txt had to be moved upwards in order
to make TEST_SUITE_LIT command available in subdirectories.
GPU tests are not well suited for running in parallel as they will be bottlenecked by GPU (few of them, high start-up overhead).
`cmake -DCUDA_JOBS=N` will set the limit on number of simultaneous CUDA tests to N.
https://reviews.llvm.org/D27728
Files:
CMakeLists.txt
External/CUDA/CMakeLists.txt
Index: External/CUDA/CMakeLists.txt
===================================================================
--- External/CUDA/CMakeLists.txt
+++ External/CUDA/CMakeLists.txt
@@ -40,6 +40,8 @@
target_link_libraries(${_executable} ${VariantLibs})
endif()
add_dependencies(cuda-tests-simple-${VariantSuffix} ${_executable})
+ # Local tests are presumed to be fast.
+ list(APPEND CUDA_SIMPLE_TEST_TARGETS ${_executable}.test)
endmacro()
# Create targets for CUDA tests that are part of the test suite.
@@ -132,6 +134,15 @@
if(EXISTS ${THRUST_PATH} AND (NOT ${Std} STREQUAL "c++14"))
create_thrust_tests(${VariantSuffix})
endif()
+
+ # Target for CUDA tests that take little time to build and run.
+ add_custom_target(check-cuda-simple-${VariantSuffix}
+ COMMAND ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS}
+ ${CUDA_SIMPLE_TEST_TARGETS}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS cuda-tests-simple-${VariantSuffix}
+ USES_TERMINAL)
+ add_dependencies(check-cuda-simple check-cuda-simple-${VariantSuffix})
endfunction(create_cuda_test_variant)
macro(create_cuda_tests)
@@ -156,13 +167,19 @@
# Special target to build all simple tests. Useful for quick smoke test
# before we embark on heavy-duty compilation which may not be worth it.
add_custom_target(cuda-tests-simple
- COMMENT "Build all simple CUDA tests")
+ COMMENT "Build all simple CUDA tests")
+ add_custom_target(check-cuda-simple
+ COMMENT "Run all simple CUDA tests")
# set default GPU arch
if(NOT CUDA_GPU_ARCH)
list(APPEND CUDA_GPU_ARCH sm_35)
endif()
+ if (CUDA_JOBS)
+ set(TEST_SUITE_LIT_FLAGS ${TEST_SUITE_LIT_FLAGS} -j ${CUDA_JOBS})
+ endif()
+
foreach(GpuArch IN LISTS CUDA_GPU_ARCH)
list(APPEND CPPFLAGS --cuda-gpu-arch=${GpuArch})
endforeach()
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -144,6 +144,11 @@
check_symbol_exists(__mips64 "" MIPS_IS_MIPS64_ENABLED)
endif()
+find_program(TEST_SUITE_LIT NAMES "lit" "llvm-lit")
+set(TEST_SUITE_LIT_FLAGS "-sv" CACHE STRING "Flags used when running lit")
+mark_as_advanced(TEST_SUITE_LIT TEST_SUITE_LIT_FLAGS)
+mark_as_advanced(TEST_SUITE_LIT)
+
add_subdirectory(tools)
# Shortcut for the path to the fpcmp executable
set(FPCMP ${CMAKE_BINARY_DIR}/tools/fpcmp)
@@ -223,10 +228,6 @@
# Produce lit.site.cfg
configure_file("${PROJECT_SOURCE_DIR}/lit.site.cfg.in" "${CMAKE_BINARY_DIR}/lit.site.cfg")
-find_program(TEST_SUITE_LIT NAMES "lit" "llvm-lit")
-set(TEST_SUITE_LIT_FLAGS "-sv" CACHE STRING "Flags used when running lit")
-mark_as_advanced(TEST_SUITE_LIT TEST_SUITE_LIT_FLAGS)
-mark_as_advanced(TEST_SUITE_LIT)
get_property(TEST_SUITE_TARGETS GLOBAL PROPERTY TEST_SUITE_TARGETS)
add_custom_target(check
COMMAND ${TEST_SUITE_LIT} ${TEST_SUITE_LIT_FLAGS} .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27728.81293.patch
Type: text/x-patch
Size: 2894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/7831e9c7/attachment.bin>
More information about the llvm-commits
mailing list