[INFRA] Import NVIDIA/CCCL upstream as optimization reference library
CCCL (CUDA C++ Core Libraries) provides: - CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk) - Thrust: high-level parallel algorithms (transform_reduce, sort, scan) - libcudacxx: CUDA C++ standard library (atomics, barriers, memory) - cudax: experimental features (memory resources, allocators) - Tuning policies: per-SM hardware-specific algorithm parameters Competition optimization vectors mapped to CCCL: - Output TPS (83% weight): warp_reduce, block_reduce, device_topk - Input TPS (14% weight): device_scan, block_load, prefetch - Cache TPS (3% weight): prefix caching strategy patterns - Memory (0.9 util): pooled/cached/buddy allocators Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only) License: Apache-2.0
This commit is contained in:
52
cccl_upstream/thrust/cmake/ThrustRunExample.cmake
Normal file
52
cccl_upstream/thrust/cmake/ThrustRunExample.cmake
Normal file
@@ -0,0 +1,52 @@
|
||||
# Inputs:
|
||||
#
|
||||
# Variable | Type | Doc
|
||||
# ---------------------|----------|--------------------------------------
|
||||
# EXAMPLE_EXECUTABLE | FilePath | Path to example executable
|
||||
# FILECHECK_ENABLED | Boolean | Run FileCheck comparison test
|
||||
# FILECHECK_EXECUTABLE | FilePath | Path to the LLVM FileCheck utility
|
||||
# REFERENCE_FILE | FilePath | Path to the FileCheck reference file
|
||||
|
||||
if (FILECHECK_ENABLED)
|
||||
if (NOT EXISTS "${REFERENCE_FILE}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"FileCheck requested for '${EXAMPLE_EXECUTABLE}', but reference file "
|
||||
"does not exist at '${REFERENCE_FILE}`."
|
||||
)
|
||||
endif()
|
||||
|
||||
# If the reference file is empty, validate that the example doesn't
|
||||
# produce any output.
|
||||
file(SIZE "${REFERENCE_FILE}" file_size)
|
||||
message("${REFERENCE_FILE}: ${file_size} bytes")
|
||||
|
||||
if (file_size EQUAL 0)
|
||||
set(check_empty_output TRUE)
|
||||
set(filecheck_command)
|
||||
else()
|
||||
set(check_empty_output FALSE)
|
||||
set(filecheck_command COMMAND "${FILECHECK_EXECUTABLE}" "${REFERENCE_FILE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${EXAMPLE_EXECUTABLE}" ${filecheck_command}
|
||||
RESULT_VARIABLE exit_code
|
||||
OUTPUT_VARIABLE stdout
|
||||
ERROR_VARIABLE stderr
|
||||
)
|
||||
|
||||
if (NOT 0 EQUAL exit_code)
|
||||
message(FATAL_ERROR "${EXAMPLE_EXECUTABLE} failed (${exit_code}):\n${stderr}")
|
||||
endif()
|
||||
|
||||
if (check_empty_output)
|
||||
string(LENGTH "${stdout}" stdout_size)
|
||||
if (NOT stdout_size EQUAL 0)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"${EXAMPLE_EXECUTABLE}: output received, but not expected:\n${stdout}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user