| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | define_property(TARGET PROPERTY _THRUST_HOST |
| | BRIEF_DOCS "A target's host system: CPP, TBB, or OMP." |
| | FULL_DOCS "A target's host system: CPP, TBB, or OMP." |
| | ) |
| | define_property(TARGET PROPERTY _THRUST_DEVICE |
| | BRIEF_DOCS "A target's device system: CUDA, CPP, TBB, or OMP." |
| | FULL_DOCS "A target's device system: CUDA, CPP, TBB, or OMP." |
| | ) |
| | define_property(TARGET PROPERTY _THRUST_DIALECT |
| | BRIEF_DOCS "A target's C++ dialect: 11, 14, or 17." |
| | FULL_DOCS "A target's C++ dialect: 11, 14, or 17." |
| | ) |
| | define_property(TARGET PROPERTY _THRUST_PREFIX |
| | BRIEF_DOCS "A prefix describing the config, eg. 'thrust.cpp.cuda.cpp14'." |
| | FULL_DOCS "A prefix describing the config, eg. 'thrust.cpp.cuda.cpp14'." |
| | ) |
| |
|
| | function(thrust_set_target_properties target_name host device dialect prefix) |
| | set_target_properties(${target_name} |
| | PROPERTIES |
| | _THRUST_HOST ${host} |
| | _THRUST_DEVICE ${device} |
| | _THRUST_DIALECT ${dialect} |
| | _THRUST_PREFIX ${prefix} |
| | ) |
| |
|
| | get_target_property(type ${target_name} TYPE) |
| | if (NOT ${type} STREQUAL "INTERFACE_LIBRARY") |
| | set_target_properties(${target_name} |
| | PROPERTIES |
| | CXX_STANDARD ${dialect} |
| | CUDA_STANDARD ${dialect} |
| | |
| | |
| | |
| | |
| | |
| | |
| | CXX_STANDARD_REQUIRED ON |
| | CUDA_STANDARD_REQUIRED ON |
| | ARCHIVE_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}" |
| | LIBRARY_OUTPUT_DIRECTORY "${THRUST_LIBRARY_OUTPUT_DIR}" |
| | RUNTIME_OUTPUT_DIRECTORY "${THRUST_EXECUTABLE_OUTPUT_DIR}" |
| | ) |
| |
|
| | |
| | |
| | if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18) |
| | set_target_properties(${target_name} |
| | PROPERTIES |
| | CUDA_ARCHITECTURES OFF |
| | ) |
| | endif() |
| |
|
| | if ("CUDA" STREQUAL "${device}" AND |
| | "Feta" STREQUAL "${CMAKE_CUDA_COMPILER_ID}") |
| | set_target_properties(${target_name} PROPERTIES |
| | CUDA_RESOLVE_DEVICE_SYMBOLS OFF |
| | ) |
| | endif() |
| | endif() |
| | endfunction() |
| |
|
| | |
| | |
| | macro(thrust_get_target_property prop_var target_name prop) |
| | get_property(${prop_var} TARGET ${target_name} PROPERTY _THRUST_${prop}) |
| | endmacro() |
| |
|
| | |
| | |
| | |
| | |
| | |
| | macro(thrust_get_target_properties target_name) |
| | thrust_get_target_property(${target_name}_HOST ${target_name} HOST) |
| | thrust_get_target_property(${target_name}_DEVICE ${target_name} DEVICE) |
| | thrust_get_target_property(${target_name}_DIALECT ${target_name} DIALECT) |
| | thrust_get_target_property(${target_name}_PREFIX ${target_name} PREFIX) |
| | endmacro() |
| |
|
| | |
| | function(thrust_clone_target_properties dst_target src_target) |
| | thrust_get_target_properties(${src_target}) |
| | thrust_set_target_properties(${dst_target} |
| | ${${src_target}_HOST} |
| | ${${src_target}_DEVICE} |
| | ${${src_target}_DIALECT} |
| | ${${src_target}_PREFIX} |
| | ) |
| | endfunction() |
| |
|
| | |
| | function(_thrust_is_config_valid var_name host device dialect) |
| | if (THRUST_MULTICONFIG_ENABLE_SYSTEM_${host} AND |
| | THRUST_MULTICONFIG_ENABLE_SYSTEM_${device} AND |
| | THRUST_MULTICONFIG_ENABLE_DIALECT_CPP${dialect} AND |
| | "${host}_${device}" IN_LIST THRUST_MULTICONFIG_WORKLOAD_${THRUST_MULTICONFIG_WORKLOAD}_CONFIGS) |
| | set(${var_name} TRUE PARENT_SCOPE) |
| | else() |
| | set(${var_name} FALSE PARENT_SCOPE) |
| | endif() |
| | endfunction() |
| |
|
| | function(_thrust_init_target_list) |
| | set(THRUST_TARGETS "" CACHE INTERNAL "" FORCE) |
| | endfunction() |
| |
|
| | function(_thrust_add_target_to_target_list target_name host device dialect prefix) |
| | thrust_set_target_properties(${target_name} ${host} ${device} ${dialect} ${prefix}) |
| |
|
| | target_link_libraries(${target_name} INTERFACE |
| | thrust.compiler_interface |
| | ) |
| |
|
| | |
| | |
| | if ((NOT host STREQUAL "TBB") OR (NOT device STREQUAL "CUDA")) |
| | target_link_libraries(${target_name} INTERFACE |
| | thrust.promote_cudafe_warnings |
| | ) |
| | endif() |
| |
|
| | set(THRUST_TARGETS ${THRUST_TARGETS} ${target_name} CACHE INTERNAL "" FORCE) |
| |
|
| | set(label "${host}.${device}.cpp${dialect}") |
| | string(TOLOWER "${label}" label) |
| | message(STATUS "Enabling Thrust configuration: ${label}") |
| | endfunction() |
| |
|
| | function(_thrust_build_target_list_multiconfig) |
| | |
| | set(req_systems) |
| | if (THRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA) |
| | list(APPEND req_systems CUDA) |
| | endif() |
| | if (THRUST_MULTICONFIG_ENABLE_SYSTEM_CPP) |
| | list(APPEND req_systems CPP) |
| | endif() |
| | if (THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB) |
| | list(APPEND req_systems TBB) |
| | endif() |
| | if (THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP) |
| | list(APPEND req_systems OMP) |
| | endif() |
| |
|
| | find_package(Thrust REQUIRED CONFIG |
| | NO_DEFAULT_PATH |
| | HINTS "${Thrust_SOURCE_DIR}" |
| | COMPONENTS ${req_systems} |
| | ) |
| |
|
| | |
| | |
| | thrust_build_compiler_targets() |
| |
|
| | |
| | foreach(host IN LISTS THRUST_HOST_SYSTEM_OPTIONS) |
| | foreach(device IN LISTS THRUST_DEVICE_SYSTEM_OPTIONS) |
| | foreach(dialect IN LISTS THRUST_CPP_DIALECT_OPTIONS) |
| | _thrust_is_config_valid(config_valid ${host} ${device} ${dialect}) |
| | if (config_valid) |
| | set(prefix "thrust.${host}.${device}.cpp${dialect}") |
| | string(TOLOWER "${prefix}" prefix) |
| |
|
| | |
| | set(target_name "${prefix}") |
| | thrust_create_target(${target_name} |
| | HOST ${host} |
| | DEVICE ${device} |
| | ${THRUST_TARGET_FLAGS} |
| | ) |
| |
|
| | |
| | _thrust_add_target_to_target_list(${target_name} |
| | ${host} ${device} ${dialect} ${prefix} |
| | ) |
| |
|
| | |
| | add_custom_target(${prefix}.all) |
| | add_dependencies(thrust.all ${prefix}.all) |
| | endif() |
| | endforeach() |
| | endforeach() |
| | endforeach() |
| |
|
| | list(LENGTH THRUST_TARGETS count) |
| | message(STATUS "${count} unique thrust.host.device.dialect configurations generated") |
| | endfunction() |
| |
|
| | function(_thrust_build_target_list_singleconfig) |
| | find_package(Thrust REQUIRED CONFIG |
| | NO_DEFAULT_PATH |
| | HINTS "${Thrust_SOURCE_DIR}" |
| | ) |
| | thrust_create_target(thrust FROM_OPTIONS ${THRUST_TARGET_FLAGS}) |
| | thrust_debug_target(thrust "${THRUST_VERSION}") |
| |
|
| | set(host ${THRUST_HOST_SYSTEM}) |
| | set(device ${THRUST_DEVICE_SYSTEM}) |
| | set(dialect ${THRUST_CPP_DIALECT}) |
| | set(prefix "thrust") |
| |
|
| | |
| | |
| | thrust_build_compiler_targets() |
| |
|
| | _thrust_add_target_to_target_list(thrust ${host} ${device} ${dialect} ${prefix}) |
| | endfunction() |
| |
|
| | |
| | |
| | function(thrust_build_target_list) |
| | |
| | _thrust_init_target_list() |
| |
|
| | |
| | set(THRUST_TARGET_FLAGS) |
| | macro(add_flag_option flag docstring default) |
| | set(opt "THRUST_${flag}") |
| | option(${opt} "${docstring}" "${default}") |
| | mark_as_advanced(${opt}) |
| | if (${${opt}}) |
| | list(APPEND THRUST_TARGET_FLAGS ${flag}) |
| | endif() |
| | endmacro() |
| | add_flag_option(IGNORE_DEPRECATED_CPP_DIALECT "Don't warn about any deprecated C++ standards and compilers." OFF) |
| | add_flag_option(IGNORE_DEPRECATED_CPP_11 "Don't warn about deprecated C++11." OFF) |
| | add_flag_option(IGNORE_DEPRECATED_COMPILER "Don't warn about deprecated compilers." OFF) |
| | add_flag_option(IGNORE_CUB_VERSION_CHECK "Don't warn about mismatched CUB versions." OFF) |
| |
|
| | |
| | |
| | |
| | file(GLOB_RECURSE all_sources |
| | RELATIVE "${CMAKE_CURRENT_LIST_DIR}" |
| | "${Thrust_SOURCE_DIR}/thrust/*.h" |
| | "${Thrust_SOURCE_DIR}/thrust/*.inl" |
| | ) |
| | add_custom_target(thrust.all SOURCES ${all_sources}) |
| |
|
| | if (THRUST_ENABLE_MULTICONFIG) |
| | _thrust_build_target_list_multiconfig() |
| | else() |
| | _thrust_build_target_list_singleconfig() |
| | endif() |
| | endfunction() |
| |
|