This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for host only TUs and fix several found issues. (#340)
* Add tests to ensure headers can be compiled when alone and on host only. * Compile standalone tests in the Linux containers. * Fix issue in older images where the LLVM script prevents building the image. * Fix host only compilation of barrier, `<new>` required. * Fix host only compilation for atomic on MSVC. * Fix warning in <bit>. * Drop hacks required for GCC-5. * Move abs outside of NVRTC check in <cmath>. * Bump NVRTC maximum cpp version to 20. * Move several cmath functions back outside of the NVRTC block.
- Loading branch information
Showing
15 changed files
with
99 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function(libcudacxx_add_standalone_header_test test_file_output_var header_under_test) | ||
# ex: build/.../header_tests/cuda/std/version.cpp | ||
set(test_cpp "${CMAKE_CURRENT_BINARY_DIR}/header_tests/${header_under_test}.cpp") | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" | ||
"${test_cpp}" | ||
) | ||
|
||
set(${test_file_output_var} ${test_cpp} PARENT_SCOPE) | ||
# ex: cuda/std/version -> cuda_std_version | ||
string(REPLACE "/" "_" executable_name ${header_under_test}) | ||
add_executable(${executable_name} ${test_cpp}) | ||
target_include_directories(${executable_name} PRIVATE ${CMAKE_SOURCE_DIR}/include) | ||
target_compile_options(${executable_name} PRIVATE | ||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: | ||
-Wall -Werror> | ||
$<$<CXX_COMPILER_ID:MSVC>: | ||
/W4 /WX>) | ||
set_target_properties(${executable_name} PROPERTIES CXX_STANDARD 11) | ||
endfunction() | ||
|
||
# Don't generate CUDA targets, they fail currently. | ||
# file(GLOB cuda_headers LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/cuda/*) | ||
file(GLOB cuda_std_headers LIST_DIRECTORIES false RELATIVE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/cuda/std/*) | ||
|
||
foreach(header IN LISTS cuda_headers cuda_std_headers) | ||
libcudacxx_add_standalone_header_test(test_file ${header}) | ||
message(STATUS "Detected ${header} ... Writing ${test_file}") | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <@header_under_test@> | ||
|
||
int main() { | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,4 +230,3 @@ if (_libcudacxx_enable_tests) | |
ARGS ${LLVM_LIT_EXTRA_ARGS} | ||
) | ||
endif () | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters