CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
113 lines
3.9 KiB
CMake
113 lines
3.9 KiB
CMake
# ########################################################################
|
|
# Copyright 2020-2025 Advanced Micro Devices, Inc.
|
|
# ########################################################################
|
|
|
|
function(add_thrust_example EXAMPLE)
|
|
set(EXAMPLE_SOURCE "${EXAMPLE}.cu")
|
|
set(EXAMPLE_TARGET "example_thrust_${EXAMPLE}")
|
|
if(USE_HIPCXX)
|
|
set_source_files_properties(${EXAMPLE_SOURCE}
|
|
PROPERTIES
|
|
LANGUAGE HIP
|
|
)
|
|
else()
|
|
set_source_files_properties(${EXAMPLE_SOURCE}
|
|
PROPERTIES
|
|
LANGUAGE CXX
|
|
)
|
|
endif()
|
|
add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCE})
|
|
|
|
target_compile_options(${EXAMPLE_TARGET} PRIVATE ${COMPILE_OPTIONS})
|
|
target_link_libraries(${EXAMPLE_TARGET}
|
|
PRIVATE
|
|
rocthrust
|
|
roc::rocprim_hip
|
|
)
|
|
if (NOT WIN32)
|
|
foreach(gpu_target ${GPU_TARGETS})
|
|
target_link_libraries(${EXAMPLE_TARGET}
|
|
INTERFACE
|
|
--cuda-gpu-arch=${gpu_target}
|
|
)
|
|
endforeach()
|
|
endif()
|
|
set_target_properties(${EXAMPLE_TARGET}
|
|
PROPERTIES
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/"
|
|
)
|
|
if (WIN32 AND NOT DEFINED DLLS_COPIED)
|
|
set(DLLS_COPIED "YES")
|
|
set(DLLS_COPIED ${DLLS_COPIED} PARENT_SCOPE)
|
|
# for now adding in all .dll as dependency chain is not cmake based on win32
|
|
file( GLOB third_party_dlls
|
|
LIST_DIRECTORIES ON
|
|
CONFIGURE_DEPENDS
|
|
${HIP_DIR}/bin/*.dll
|
|
${CMAKE_SOURCE_DIR}/rtest.*
|
|
)
|
|
foreach( file_i ${third_party_dlls})
|
|
add_custom_command( TARGET ${EXAMPLE_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${file_i} ${PROJECT_BINARY_DIR}/examples )
|
|
endforeach( file_i )
|
|
endif()
|
|
endfunction()
|
|
|
|
|
|
add_subdirectory(cpp_integration)
|
|
|
|
# ****************************************************************************
|
|
# Examples
|
|
# ****************************************************************************
|
|
message (STATUS "Building examples")
|
|
|
|
add_thrust_example("arbitrary_transformation")
|
|
add_thrust_example("basic_vector")
|
|
add_thrust_example("bounding_box")
|
|
# add_thrust_example("bucket_sort2d")
|
|
add_thrust_example("constant_iterator")
|
|
add_thrust_example("counting_iterator")
|
|
add_thrust_example("device_ptr")
|
|
add_thrust_example("discrete_voronoi")
|
|
add_thrust_example("dot_products_with_zip")
|
|
add_thrust_example("expand")
|
|
add_thrust_example("fill_copy_sequence")
|
|
add_thrust_example("histogram")
|
|
add_thrust_example("lambda")
|
|
add_thrust_example("lexicographical_sort")
|
|
add_thrust_example("max_abs_diff")
|
|
add_thrust_example("minimal_custom_backend")
|
|
add_thrust_example("minmax")
|
|
add_thrust_example("mode")
|
|
add_thrust_example("monte_carlo_disjoint_sequences")
|
|
add_thrust_example("monte_carlo")
|
|
add_thrust_example("norm")
|
|
add_thrust_example("padded_grid_reduction")
|
|
add_thrust_example("permutation_iterator")
|
|
add_thrust_example("print_version")
|
|
add_thrust_example("raw_reference_cast")
|
|
add_thrust_example("remove_points2d")
|
|
add_thrust_example("repeated_range")
|
|
add_thrust_example("run_length_decoding")
|
|
add_thrust_example("run_length_encoding")
|
|
add_thrust_example("saxpy")
|
|
add_thrust_example("scan_by_key")
|
|
add_thrust_example("set_operations")
|
|
add_thrust_example("simple_moving_average")
|
|
add_thrust_example("sort")
|
|
add_thrust_example("sorting_aos_vs_soa")
|
|
add_thrust_example("sparse_vector")
|
|
add_thrust_example("stream_compaction")
|
|
add_thrust_example("strided_range")
|
|
add_thrust_example("sum_rows")
|
|
add_thrust_example("sum")
|
|
add_thrust_example("summary_statistics")
|
|
add_thrust_example("summed_area_table")
|
|
add_thrust_example("tiled_range")
|
|
add_thrust_example("transform_iterator")
|
|
add_thrust_example("transform_input_output_iterator")
|
|
add_thrust_example("transform_output_iterator")
|
|
add_thrust_example("uninitialized_vector")
|
|
add_thrust_example("scan_matrix_by_rows")
|
|
# add_thrust_example("weld_vertices") // this example does not work yet.
|
|
add_thrust_example("word_count")
|