├── docs
├── fix_html_titles
│ ├── __init__.py
│ └── __main__.py
├── _static
│ ├── stdgpu_logo.ico
│ ├── stdgpu_logo.png
│ ├── stdgpu_custom_sphinx.css
│ └── stdgpu_custom_doxygen.css
├── api
│ └── chapters.md
├── requirements.txt
├── doxygen_src
│ └── modules.doxy
├── development
│ └── contributing
│ │ ├── tests.md
│ │ ├── documentation.md
│ │ └── coding_style.md
├── conf.py
└── getting_started
│ └── integrating_into_your_project.md
├── src
├── CMakeLists.txt
└── stdgpu
│ ├── impl
│ ├── platform_check.h
│ ├── iterator.cpp
│ ├── device.cpp
│ ├── preprocessor.h
│ ├── queue_detail.cuh
│ ├── stack_detail.cuh
│ └── numeric_detail.h
│ ├── openmp
│ ├── platform_check.h
│ ├── device.h
│ ├── CMakeLists.txt
│ ├── impl
│ │ ├── device.cpp
│ │ ├── memory.cpp
│ │ └── memory_detail.h
│ └── platform.h
│ ├── device.h
│ ├── hip
│ ├── device.h
│ ├── platform_check.h
│ ├── CMakeLists.txt
│ ├── impl
│ │ ├── error.h
│ │ └── memory.cpp
│ └── platform.h
│ ├── cuda
│ ├── device.h
│ ├── platform_check.h
│ ├── CMakeLists.txt
│ ├── impl
│ │ ├── error.h
│ │ └── memory.cpp
│ └── platform.h
│ ├── type_traits.h
│ ├── execution.h
│ ├── cstddef.h
│ ├── config.h.in
│ └── compiler.h
├── tools
├── ubuntu
│ ├── install_lcov.sh
│ ├── install_cppcheck.sh
│ ├── install_clang_tidy.sh
│ ├── install_clang_format.sh
│ ├── install_docs_dependencies.sh
│ ├── install_openmp.sh
│ └── set_cxx_compiler.sh
├── dev
│ ├── run_coverage.sh
│ ├── apply_code_style.sh
│ ├── check_code_style.sh
│ ├── build_documentation.sh
│ ├── verify_headers.sh
│ ├── download_dependencies.sh
│ ├── download_thrust.sh
│ └── color_contrast.py
├── backend
│ ├── configure_openmp_lcov.sh
│ ├── helper
│ │ ├── configure.sh
│ │ └── create_empty_directory.sh
│ ├── configure_openmp_clang_tidy.sh
│ ├── configure_openmp_cppcheck.sh
│ ├── configure_openmp_documentation.sh
│ ├── configure_cuda.sh
│ ├── configure_hip.sh
│ ├── configure_openmp.sh
│ └── check_install_openmp.sh
├── run_tests.sh
├── install.sh
├── build.sh
├── uninstall.sh
└── setup.sh
├── CONTRIBUTING.md
├── .gitignore
├── .github
├── dependabot.yml
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
└── workflows
│ ├── docs.yml
│ ├── coverage.yml
│ └── lint.yml
├── tests
├── install_test
│ ├── CMakeLists.txt
│ └── install_test.cpp
├── stdgpu
│ ├── openmp
│ │ ├── CMakeLists.txt
│ │ ├── atomic.cpp
│ │ ├── bitset.cpp
│ │ ├── deque.cpp
│ │ ├── mutex.cpp
│ │ ├── vector.cpp
│ │ ├── unordered_map.cpp
│ │ └── unordered_set.cpp
│ ├── cuda
│ │ ├── CMakeLists.txt
│ │ ├── atomic.cu
│ │ ├── bitset.cu
│ │ ├── deque.cu
│ │ ├── mutex.cu
│ │ ├── vector.cu
│ │ ├── unordered_map.cu
│ │ ├── unordered_set.cu
│ │ └── memory.cu
│ ├── hip
│ │ ├── CMakeLists.txt
│ │ ├── atomic.hip
│ │ ├── bitset.hip
│ │ ├── deque.hip
│ │ ├── mutex.hip
│ │ ├── vector.hip
│ │ ├── unordered_map.hip
│ │ ├── unordered_set.hip
│ │ └── memory.hip
│ ├── memory.cpp
│ ├── CMakeLists.txt
│ └── numeric.cpp
├── CMakeLists.txt
├── test_memory_utils.cpp
└── test_memory_utils_detail.h
├── cmake
├── openmp
│ ├── set_device_flags.cmake
│ └── determine_thrust_paths.cmake
├── stdgpu-config.cmake.in
├── add_uninstall_target.cmake
├── stdgpu-dependencies.cmake.in
├── setup_clang_tidy.cmake
├── setup_cppcheck.cmake
├── cuda
│ ├── determine_thrust_paths.cmake
│ ├── compute_capability.cpp
│ └── check_compute_capability.cmake
├── FindCppcheck.cmake
├── FindClangTidy.cmake
├── cmake_uninstall.cmake.in
├── FindClangFormat.cmake
├── hip
│ ├── Findthrust.cmake
│ └── set_device_flags.cmake
├── set_host_flags.cmake
├── setup_clang_format.cmake
├── Findthrust.cmake
└── config_summary.cmake
├── benchmarks
├── stdgpu
│ ├── cuda
│ │ ├── CMakeLists.txt
│ │ ├── bitset.cu
│ │ ├── deque.cu
│ │ ├── mutex.cu
│ │ ├── vector.cu
│ │ ├── unordered_map.cu
│ │ └── unordered_set.cu
│ ├── hip
│ │ ├── CMakeLists.txt
│ │ ├── bitset.hip
│ │ ├── deque.hip
│ │ ├── mutex.hip
│ │ ├── vector.hip
│ │ ├── unordered_map.hip
│ │ └── unordered_set.hip
│ ├── openmp
│ │ ├── CMakeLists.txt
│ │ ├── bitset.cpp
│ │ ├── deque.cpp
│ │ ├── mutex.cpp
│ │ ├── vector.cpp
│ │ ├── unordered_map.cpp
│ │ └── unordered_set.cpp
│ ├── CMakeLists.txt
│ └── mutex.inc
├── CMakeLists.txt
└── benchmark_utils.h
├── examples
├── openmp
│ ├── CMakeLists.txt
│ ├── iterator.cpp
│ ├── vector.cpp
│ ├── atomic.cpp
│ ├── unordered_set.cpp
│ └── deque.cpp
├── cuda
│ ├── CMakeLists.txt
│ ├── iterator.cu
│ └── atomic.cu
├── hip
│ ├── CMakeLists.txt
│ ├── iterator.hip
│ └── atomic.hip
├── README.md
├── CMakeLists.txt
├── contract.cpp
└── createAndDestroyDeviceArray.cpp
├── .clang-format
└── .clang-tidy
/docs/fix_html_titles/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(stdgpu)
2 |
--------------------------------------------------------------------------------
/docs/_static/stdgpu_logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stotko/stdgpu/HEAD/docs/_static/stdgpu_logo.ico
--------------------------------------------------------------------------------
/docs/_static/stdgpu_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stotko/stdgpu/HEAD/docs/_static/stdgpu_logo.png
--------------------------------------------------------------------------------
/docs/api/chapters.md:
--------------------------------------------------------------------------------
1 | Chapters
2 | ========
3 |
4 | ```{toctree}
5 |
6 | memory
7 | iterator
8 | object
9 | ```
10 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_lcov.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Install lcov
5 | sudo apt-get update
6 | sudo apt-get install lcov
7 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_cppcheck.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Install cppcheck
5 | sudo apt-get update
6 | sudo apt-get install cppcheck
7 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_clang_tidy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Install clang-tidy
5 | sudo apt-get update
6 | sudo apt-get install clang-tidy
7 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_clang_format.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Install clang-format version 18
5 | sudo apt-get update
6 | sudo apt-get install clang-format-18
7 |
--------------------------------------------------------------------------------
/tools/dev/run_coverage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Run tests
5 | cmake -E cmake_echo_color --blue ">>>>> Run code coverage"
6 | cmake --build build --target stdgpu_coverage
7 |
--------------------------------------------------------------------------------
/tools/dev/apply_code_style.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Apply code style
5 | cmake -E cmake_echo_color --blue ">>>>> Apply code style"
6 | cmake --build build --target apply_code_style
7 |
--------------------------------------------------------------------------------
/tools/dev/check_code_style.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check code style
5 | cmake -E cmake_echo_color --blue ">>>>> Check code style"
6 | cmake --build build --target check_code_style
7 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx
2 | sphinx-book-theme
3 | sphinx_copybutton
4 | sphinx-design
5 | sphinx-togglebutton
6 | sphinxcontrib-doxylink
7 | doxysphinx
8 | myst-parser
9 | docutils>=0.17
10 |
--------------------------------------------------------------------------------
/tools/dev/build_documentation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Build documentation
5 | cmake -E cmake_echo_color --blue ">>>>> Build documentation"
6 | cmake --build build --target stdgpu_doc --parallel 13
7 |
--------------------------------------------------------------------------------
/tools/dev/verify_headers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Verify headers
5 | cmake -E cmake_echo_color --blue ">>>>> Verify headers"
6 | cmake --build build --target stdgpu_verify_interface_header_sets
7 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_docs_dependencies.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Install docs dependencies
5 | sudo apt-get update
6 | sudo apt-get install bison flex python3
7 | pip install -r docs/requirements.txt
8 |
--------------------------------------------------------------------------------
/tools/ubuntu/install_openmp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # GCC: Already installed
5 | # Clang: Install libomp-dev and remove conflicting packages
6 | sudo apt-get update
7 | sudo apt-get install libomp-dev
8 |
--------------------------------------------------------------------------------
/docs/doxygen_src/modules.doxy:
--------------------------------------------------------------------------------
1 | /**
2 |
3 | \defgroup data_structures Data Structures and Containers
4 |
5 | \defgroup utilities Complementing functionality
6 |
7 | \defgroup system Platform functionality
8 |
9 | */
10 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Thank you for taking the time to contribute to the project. All guidelines can be found in the [Contributing](https://stotko.github.io/stdgpu/development/contributing.html) section of the documentation.
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build directories
2 | /bin/
3 | /build/
4 | /build_install_test/
5 | /docs/doxygen/
6 | /external/
7 |
8 | # Python
9 | __pycache__/
10 |
11 | # Ide directories
12 | *.kdev4
13 | .kdev4/
14 | .vscode/
15 | .cache/
16 | .idea/
17 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | # Maintain dependencies for GitHub Actions
4 | - package-ecosystem: "github-actions"
5 | directory: "/"
6 | schedule:
7 | interval: "weekly"
8 | groups:
9 | actions:
10 | patterns:
11 | - "*"
12 |
--------------------------------------------------------------------------------
/tools/dev/download_dependencies.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Create external directory
5 | cmake -E cmake_echo_color --blue ">>>>> Download external dependencies"
6 | sh tools/backend/helper/create_empty_directory.sh external
7 |
8 | # Download thrust
9 | sh tools/dev/download_thrust.sh
10 |
--------------------------------------------------------------------------------
/tools/dev/download_thrust.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | cmake -E cmake_echo_color --blue ">>>>> Download thrust"
5 | cmake -E chdir external git clone https://github.com/NVIDIA/cccl
6 | cmake -E chdir external/cccl git fetch --all --tags --prune
7 | cmake -E chdir external/cccl git checkout tags/v2.2.0
8 |
--------------------------------------------------------------------------------
/tools/backend/configure_openmp_lcov.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Create build directory
5 | sh tools/backend/helper/create_empty_directory.sh build
6 |
7 | # Configure project
8 | sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_TEST_COVERAGE=ON -Dthrust_ROOT=external/cccl/thrust
9 |
--------------------------------------------------------------------------------
/tests/install_test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | project(install_test LANGUAGES CXX)
4 |
5 |
6 | find_package(stdgpu REQUIRED)
7 |
8 |
9 | add_executable(install_test)
10 |
11 | target_sources(install_test PRIVATE install_test.cpp)
12 |
13 | target_link_libraries(install_test PRIVATE stdgpu::stdgpu)
14 |
15 |
--------------------------------------------------------------------------------
/cmake/openmp/set_device_flags.cmake:
--------------------------------------------------------------------------------
1 | function(stdgpu_set_device_flags STDGPU_OUTPUT_DEVICE_FLAGS)
2 | # No flags required
3 | endfunction()
4 |
5 |
6 | # Auxiliary compiler flags for tests to be used with target_compile_options
7 | function(stdgpu_set_test_device_flags STDGPU_OUTPUT_DEVICE_TEST_FLAGS)
8 | # No flags required
9 | endfunction()
10 |
--------------------------------------------------------------------------------
/cmake/stdgpu-config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | include("${CMAKE_CURRENT_LIST_DIR}/stdgpu-dependencies.cmake")
4 |
5 | include("${CMAKE_CURRENT_LIST_DIR}/stdgpu-targets.cmake")
6 |
7 | set_and_check(stdgpu_INCLUDE_DIRS "@PACKAGE_STDGPU_INCLUDE_INSTALL_DIR@")
8 | set(stdgpu_LIBRARIES stdgpu::stdgpu)
9 |
10 | check_required_components(stdgpu)
11 |
--------------------------------------------------------------------------------
/tools/backend/helper/configure.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [ "$#" = 0 ]; then
5 | CONFIG="Release"
6 | else
7 | CONFIG=$1
8 | shift
9 | fi
10 |
11 | # Configure project
12 | cmake -E cmake_echo_color --blue ">>>>> Configure stdgpu project ($CONFIG)"
13 | cmake -B build -S . -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_INSTALL_PREFIX=bin $@
14 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(benchmarkstdgpu PRIVATE bitset.cu
3 | deque.cu
4 | mutex.cu
5 | unordered_map.cu
6 | unordered_set.cu
7 | vector.cu)
8 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(benchmarkstdgpu PRIVATE bitset.hip
3 | deque.hip
4 | mutex.hip
5 | unordered_map.hip
6 | unordered_set.hip
7 | vector.hip)
8 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(benchmarkstdgpu PRIVATE bitset.cpp
3 | deque.cpp
4 | mutex.cpp
5 | unordered_map.cpp
6 | unordered_set.cpp
7 | vector.cpp)
8 |
--------------------------------------------------------------------------------
/examples/openmp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | stdgpu_add_example_cpp(atomic)
3 | stdgpu_add_example_cpp(bitset)
4 | stdgpu_add_example_cpp(deque)
5 | stdgpu_add_example_cpp(iterator)
6 | stdgpu_add_example_cpp(mutex_array)
7 | stdgpu_add_example_cpp(ranges)
8 | stdgpu_add_example_cpp(unordered_map)
9 | stdgpu_add_example_cpp(unordered_set)
10 | stdgpu_add_example_cpp(vector)
11 |
--------------------------------------------------------------------------------
/tools/backend/configure_openmp_clang_tidy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Create build directory
5 | sh tools/backend/helper/create_empty_directory.sh build
6 |
7 | # Configure project
8 | sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CLANG_TIDY=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
9 |
--------------------------------------------------------------------------------
/tools/backend/configure_openmp_cppcheck.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Create build directory
5 | sh tools/backend/helper/create_empty_directory.sh build
6 |
7 | # Configure project
8 | sh tools/backend/helper/configure.sh Debug -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_ANALYZE_WITH_CPPCHECK=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
9 |
--------------------------------------------------------------------------------
/tools/backend/configure_openmp_documentation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Create build directory
5 | sh tools/backend/helper/create_empty_directory.sh build
6 |
7 | # Configure project
8 | sh tools/backend/helper/configure.sh Release -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_BUILD_DOCUMENTATION=ON -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust
9 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(teststdgpu PRIVATE atomic.cpp
3 | bitset.cpp
4 | deque.cpp
5 | mutex.cpp
6 | unordered_map.cpp
7 | unordered_set.cpp
8 | vector.cpp)
9 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(teststdgpu PRIVATE atomic.cu
3 | bitset.cu
4 | deque.cu
5 | memory.cu
6 | mutex.cu
7 | unordered_map.cu
8 | unordered_set.cu
9 | vector.cu)
10 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | target_sources(teststdgpu PRIVATE atomic.hip
3 | bitset.hip
4 | deque.hip
5 | memory.hip
6 | mutex.hip
7 | unordered_map.hip
8 | unordered_set.hip
9 | vector.hip)
10 |
--------------------------------------------------------------------------------
/tools/backend/configure_cuda.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [ "$#" = 0 ]; then
5 | CONFIG="Release"
6 | else
7 | CONFIG=$1
8 | shift
9 | fi
10 |
11 | # Create build directory
12 | sh tools/backend/helper/create_empty_directory.sh build
13 |
14 | # Configure project
15 | sh tools/backend/helper/configure.sh $CONFIG -DSTDGPU_BACKEND=STDGPU_BACKEND_CUDA -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON $@
16 |
--------------------------------------------------------------------------------
/examples/cuda/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | macro(stdgpu_add_example_cu)
3 | stdgpu_detail_add_example(${ARGV0} "cu")
4 | endmacro()
5 |
6 | stdgpu_add_example_cu(atomic)
7 | stdgpu_add_example_cu(bitset)
8 | stdgpu_add_example_cu(deque)
9 | stdgpu_add_example_cu(iterator)
10 | stdgpu_add_example_cu(mutex_array)
11 | stdgpu_add_example_cu(ranges)
12 | stdgpu_add_example_cu(unordered_map)
13 | stdgpu_add_example_cu(unordered_set)
14 | stdgpu_add_example_cu(vector)
15 |
--------------------------------------------------------------------------------
/examples/hip/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | macro(stdgpu_add_example_hip)
3 | stdgpu_detail_add_example(${ARGV0} "hip")
4 | endmacro()
5 |
6 | stdgpu_add_example_hip(atomic)
7 | stdgpu_add_example_hip(bitset)
8 | stdgpu_add_example_hip(deque)
9 | stdgpu_add_example_hip(iterator)
10 | stdgpu_add_example_hip(mutex_array)
11 | stdgpu_add_example_hip(ranges)
12 | stdgpu_add_example_hip(unordered_map)
13 | stdgpu_add_example_hip(unordered_set)
14 | stdgpu_add_example_hip(vector)
15 |
--------------------------------------------------------------------------------
/tools/run_tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 0 ] && [ "$#" -ne 1 ]; then
6 | cmake -E echo "run_tests: Expected 0 or 1 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | if [ "$#" = 0 ]; then
11 | CONFIG="Release"
12 | else
13 | CONFIG=$1
14 | fi
15 |
16 | # Run tests
17 | cmake -E cmake_echo_color --blue ">>>>> Run tests ($CONFIG)"
18 | cmake -E chdir build ctest -V -C $CONFIG
19 |
--------------------------------------------------------------------------------
/tools/backend/configure_hip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [ "$#" = 0 ]; then
5 | CONFIG="Release"
6 | else
7 | CONFIG=$1
8 | shift
9 | fi
10 |
11 | # Create build directory
12 | sh tools/backend/helper/create_empty_directory.sh build
13 |
14 | # Configure project
15 | sh tools/backend/helper/configure.sh $CONFIG -DSTDGPU_BACKEND=STDGPU_BACKEND_HIP -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON -DCMAKE_CXX_COMPILER=hipcc $@
16 |
--------------------------------------------------------------------------------
/tools/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 0 ] && [ "$#" -ne 1 ]; then
6 | cmake -E echo "install: Expected 0 or 1 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | if [ "$#" = 0 ]; then
11 | CONFIG="Release"
12 | else
13 | CONFIG=$1
14 | fi
15 |
16 | # Install project
17 | cmake -E cmake_echo_color --blue ">>>>> Install stdgpu project ($CONFIG)"
18 | cmake --install build --config $CONFIG
19 |
--------------------------------------------------------------------------------
/cmake/add_uninstall_target.cmake:
--------------------------------------------------------------------------------
1 | # https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
2 |
3 | # uninstall target
4 | if(NOT TARGET uninstall)
5 | configure_file(
6 | "${CMAKE_CURRENT_LIST_DIR}/cmake_uninstall.cmake.in"
7 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
8 | IMMEDIATE @ONLY)
9 |
10 | add_custom_target(uninstall
11 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
12 | endif()
13 |
--------------------------------------------------------------------------------
/tools/backend/configure_openmp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [ "$#" = 0 ]; then
5 | CONFIG="Release"
6 | else
7 | CONFIG=$1
8 | shift
9 | fi
10 |
11 | # Create build directory
12 | sh tools/backend/helper/create_empty_directory.sh build
13 |
14 | # Configure project
15 | sh tools/backend/helper/configure.sh $CONFIG -DSTDGPU_BACKEND=STDGPU_BACKEND_OPENMP -DSTDGPU_COMPILE_WARNING_AS_ERROR=ON -Dthrust_ROOT=external/cccl/thrust -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON $@
16 |
--------------------------------------------------------------------------------
/tools/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 0 ] && [ "$#" -ne 1 ]; then
6 | cmake -E echo "build: Expected 0 or 1 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | if [ "$#" = 0 ]; then
11 | CONFIG="Release"
12 | else
13 | CONFIG=$1
14 | fi
15 |
16 | # Build project
17 | cmake -E cmake_echo_color --blue ">>>>> Build stdgpu project ($CONFIG)"
18 | cmake --build build --config ${CONFIG} --parallel 13
19 |
--------------------------------------------------------------------------------
/tools/uninstall.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 0 ] && [ "$#" -ne 1 ]; then
6 | cmake -E echo "install: Expected 0 or 1 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | if [ "$#" = 0 ]; then
11 | CONFIG="Release"
12 | else
13 | CONFIG=$1
14 | fi
15 |
16 | # Uninstall project
17 | cmake -E cmake_echo_color --blue ">>>>> Uninstall stdgpu project ($CONFIG)"
18 | cmake --build build --config $CONFIG --target uninstall
19 |
--------------------------------------------------------------------------------
/cmake/stdgpu-dependencies.cmake.in:
--------------------------------------------------------------------------------
1 | include(CMakeFindDependencyMacro)
2 |
3 | set(STDGPU_BACKEND_DIRECTORY "@STDGPU_BACKEND_DIRECTORY@")
4 |
5 | # Backend-specific modules have higher priority than generic modules
6 | list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
7 | list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/${STDGPU_BACKEND_DIRECTORY}")
8 |
9 | @STDGPU_DEPENDENCIES_INIT@
10 | @STDGPU_DEPENDENCIES_BACKEND_INIT@
11 |
12 | list(POP_FRONT CMAKE_MODULE_PATH)
13 | list(POP_FRONT CMAKE_MODULE_PATH)
14 |
--------------------------------------------------------------------------------
/tools/ubuntu/set_cxx_compiler.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 2 ]; then
6 | cmake -E echo "set_cxx_compiler: Expected 2 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | # Set C compiler
11 | sudo update-alternatives --install /usr/bin/cc cc /usr/bin/$1 100
12 | sudo update-alternatives --set cc /usr/bin/$1
13 |
14 | # Set C++ compiler
15 | sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/$2 100
16 | sudo update-alternatives --set c++ /usr/bin/$2
17 |
--------------------------------------------------------------------------------
/tools/backend/helper/create_empty_directory.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 1 ]; then
6 | cmake -E echo "create_empty_directory: Expected 1 parameter, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | # Delete old directory
11 | cmake -E cmake_echo_color --red ">>>>> Delete directory \"$1\" from old build"
12 | cmake -E remove_directory $1
13 |
14 | # Create new directory
15 | cmake -E cmake_echo_color --green ">>>>> Create directory \"$1\" for new build"
16 | cmake -E make_directory $1
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is.
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | Language: Cpp
3 | BasedOnStyle: Mozilla
4 | # Only modifications deviating from the base style are specified
5 | Standard: c++17
6 | AccessModifierOffset: -4
7 | AllowAllArgumentsOnNextLine: false
8 | AlwaysBreakAfterReturnType: All
9 | BreakBeforeBraces: Allman
10 | ColumnLimit: 120
11 | ContinuationIndentWidth: 8
12 | FixNamespaceComments: true
13 | IndentPPDirectives: BeforeHash
14 | IndentWidth: 4
15 | PackConstructorInitializers: Never
16 | ReflowComments: true
17 | SpaceAfterTemplateKeyword: true
18 | SpaceInEmptyBlock: true
19 | ...
20 |
21 |
--------------------------------------------------------------------------------
/tools/backend/check_install_openmp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | if [ "$#" = 0 ]; then
5 | CONFIG="Release"
6 | else
7 | CONFIG=$1
8 | shift
9 | fi
10 |
11 | # Create build directory
12 | sh tools/backend/helper/create_empty_directory.sh build_install_test
13 |
14 | # Compile dependent project
15 | cmake -E cmake_echo_color --blue ">>>>> Check installation ($CONFIG)"
16 | cmake -B build_install_test -S tests/install_test -DCMAKE_BUILD_TYPE=$CONFIG -Dstdgpu_ROOT=bin -Dthrust_ROOT=external/cccl/thrust $@
17 | cmake --build build_install_test --config ${CONFIG} --parallel 13
18 |
--------------------------------------------------------------------------------
/cmake/openmp/determine_thrust_paths.cmake:
--------------------------------------------------------------------------------
1 | function(stdgpu_determine_thrust_paths STDGPU_OUTPUT_THRUST_PATHS)
2 | # Clear list before appending flags
3 | unset(${STDGPU_OUTPUT_THRUST_PATHS})
4 |
5 | find_package(CUDAToolkit QUIET)
6 |
7 | if(CUDAToolkit_FOUND)
8 | list(APPEND ${STDGPU_OUTPUT_THRUST_PATHS} "${CUDAToolkit_INCLUDE_DIRS}")
9 | endif()
10 | list(APPEND "/usr/include")
11 | list(APPEND "/usr/local/include")
12 |
13 | # Make output variable visible
14 | set(${STDGPU_OUTPUT_THRUST_PATHS} ${${STDGPU_OUTPUT_THRUST_PATHS}} PARENT_SCOPE)
15 | endfunction()
16 |
--------------------------------------------------------------------------------
/tools/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # Check number of input parameters
5 | if [ "$#" -ne 0 ] && [ "$#" -ne 1 ]; then
6 | cmake -E echo "setup: Expected 0 or 1 parameters, but received $# parameters"
7 | exit 1
8 | fi
9 |
10 | if [ "$#" = 0 ]; then
11 | CONFIG="Release"
12 | else
13 | CONFIG=$1
14 | fi
15 |
16 | # Create build directory
17 | sh tools/backend/helper/create_empty_directory.sh build
18 |
19 | # Configure project
20 | sh tools/backend/helper/configure.sh $CONFIG
21 |
22 | # Build project
23 | sh tools/build.sh $CONFIG
24 |
25 | # Run tests
26 | sh tools/run_tests.sh $CONFIG
27 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/atomic.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/bitset.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/deque.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/mutex.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/vector.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/atomic.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/bitset.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/deque.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/mutex.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/vector.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/bitset.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/deque.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/mutex.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/vector.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/bitset.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/deque.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/mutex.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/vector.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/atomic.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/bitset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/deque.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/mutex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/vector.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/bitset.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/deque.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/mutex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/vector.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/unordered_map.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/unordered_set.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/unordered_map.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/unordered_set.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/unordered_map.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/cuda/unordered_set.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/unordered_map.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/hip/unordered_set.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/unordered_map.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/tests/stdgpu/openmp/unordered_set.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/unordered_map.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/openmp/unordered_set.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | ## Examples
2 |
3 | This directory contains several examples demonstrating how stdgpu can be used. In particular, the examples can be divided into two classes:
4 |
5 | - **Host code with device support**. Examples that can be compiled and run by both the *host and device compiler* are put into this directory. This includes most of the functionality that complements the GPU data structures and containers.
6 |
7 | - **Device only code**. Since all GPU data structures and containers can be used in *native* code to cover as many use cases as possible, e.g. in custom CUDA kernels, the respective examples must be compiled by the *device compiler*. This requires knowledge about the chosen backend, so they are put into backend-specific subdirectories.
8 |
--------------------------------------------------------------------------------
/tests/stdgpu/memory.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #define STDGPU_MEMORY_TEST_CLASS stdgpu_memory
17 |
18 | #include
19 |
--------------------------------------------------------------------------------
/tests/stdgpu/cuda/memory.cu:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #define STDGPU_MEMORY_TEST_CLASS stdgpu_memory_cu
17 |
18 | #include
19 |
--------------------------------------------------------------------------------
/tests/stdgpu/hip/memory.hip:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #define STDGPU_MEMORY_TEST_CLASS stdgpu_memory_hip
17 |
18 | #include
19 |
--------------------------------------------------------------------------------
/cmake/setup_clang_tidy.cmake:
--------------------------------------------------------------------------------
1 | function(stdgpu_setup_clang_tidy STDGPU_OUTPUT_PROPERTY_CLANG_TIDY)
2 | find_package(ClangTidy REQUIRED)
3 |
4 | set(${STDGPU_OUTPUT_PROPERTY_CLANG_TIDY} "${CLANG_TIDY_EXECUTABLE}")
5 |
6 | if(NOT DEFINED STDGPU_COMPILE_WARNING_AS_ERROR)
7 | message(FATAL_ERROR "STDGPU_COMPILE_WARNING_AS_ERROR not defined.")
8 | endif()
9 |
10 | # Explicitly set the C++ standard
11 | list(APPEND ${STDGPU_OUTPUT_PROPERTY_CLANG_TIDY} "-extra-arg=-std=c++17")
12 |
13 | if(STDGPU_COMPILE_WARNING_AS_ERROR)
14 | list(APPEND ${STDGPU_OUTPUT_PROPERTY_CLANG_TIDY} "-warnings-as-errors=*")
15 | endif()
16 |
17 | # Make output variable visible
18 | set(${STDGPU_OUTPUT_PROPERTY_CLANG_TIDY} ${${STDGPU_OUTPUT_PROPERTY_CLANG_TIDY}} PARENT_SCOPE)
19 | endfunction()
20 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **Steps to reproduce**
14 | If possible, provide a *Minimal Reproducable Example*. Describe the steps to reproduce the bug.
15 |
16 | **Expected behavior**
17 | A clear and concise description of what you expected to happen.
18 |
19 | **Actual behavior**
20 | A clear and concise description of what actually happens.
21 |
22 | **System (please complete the following information):**
23 | - OS: [e.g. Ubuntu 18.04, Windows 10]
24 | - Compiler: [e.g. GCC 7, MSVC 19.2x (Visual Studio 2019)]
25 | - Backend: [e.g. CUDA, OpenMP]
26 | - Library version [e.g. 1.0.0, master]
27 |
--------------------------------------------------------------------------------
/cmake/setup_cppcheck.cmake:
--------------------------------------------------------------------------------
1 | function(stdgpu_setup_cppcheck STDGPU_OUTPUT_PROPERTY_CPPCHECK)
2 | find_package(Cppcheck REQUIRED)
3 |
4 | # Do not enable noisy "style" checks
5 | set(${STDGPU_OUTPUT_PROPERTY_CPPCHECK} "${CPPCHECK_EXECUTABLE}" "--enable=warning,performance,portability" "--force" "--inline-suppr" "--suppress=preprocessorErrorDirective" "--quiet")
6 |
7 | if(NOT DEFINED STDGPU_COMPILE_WARNING_AS_ERROR)
8 | message(FATAL_ERROR "STDGPU_COMPILE_WARNING_AS_ERROR not defined.")
9 | endif()
10 |
11 | if(STDGPU_COMPILE_WARNING_AS_ERROR)
12 | list(APPEND ${STDGPU_OUTPUT_PROPERTY_CPPCHECK} "--error-exitcode=1")
13 | endif()
14 |
15 | # Make output variable visible
16 | set(${STDGPU_OUTPUT_PROPERTY_CPPCHECK} ${${STDGPU_OUTPUT_PROPERTY_CPPCHECK}} PARENT_SCOPE)
17 | endfunction()
18 |
--------------------------------------------------------------------------------
/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(FetchContent)
2 |
3 | FetchContent_Declare(
4 | googletest
5 | PREFIX googletest
6 | URL https://github.com/google/googletest/archive/refs/tags/v1.16.0.zip
7 | URL_HASH SHA256=a9607c9215866bd425a725610c5e0f739eeb50887a57903df48891446ce6fb3c
8 | DOWNLOAD_DIR "${STDGPU_EXTERNAL_DIR}/googletest"
9 | )
10 |
11 | set(BUILD_GMOCK OFF CACHE INTERNAL "")
12 | set(INSTALL_GTEST OFF CACHE INTERNAL "")
13 |
14 | FetchContent_MakeAvailable(googletest)
15 |
16 | # Suppress clang-tidy errors on googletest by treating it as a system library
17 | # Use SYSTEM in FetchContent_Declare for CMake 3.25+ instead when it becomes available
18 | get_target_property(gtest_INCLUDE_DIRS gtest INTERFACE_INCLUDE_DIRECTORIES)
19 | set_target_properties(gtest PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${gtest_INCLUDE_DIRS}")
20 |
21 |
22 | add_subdirectory(stdgpu)
23 |
--------------------------------------------------------------------------------
/src/stdgpu/impl/platform_check.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_PLATFORM_CHECK_H
17 | #define STDGPU_PLATFORM_CHECK_H
18 |
19 | #include
20 |
21 | #include STDGPU_DETAIL_BACKEND_HEADER(platform_check.h)
22 |
23 | #endif // STDGPU_PLATFORM_CHECK_H
24 |
--------------------------------------------------------------------------------
/cmake/cuda/determine_thrust_paths.cmake:
--------------------------------------------------------------------------------
1 | function(stdgpu_determine_thrust_paths STDGPU_OUTPUT_THRUST_PATHS)
2 | # Clear list before appending flags
3 | unset(${STDGPU_OUTPUT_THRUST_PATHS})
4 |
5 | find_package(CUDAToolkit QUIET)
6 |
7 | if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 13 AND CMAKE_VERSION VERSION_LESS 3.31.9)
8 | set(STDGPU_CUDATOOLKIT_INCLUDE_DIRS "${CUDAToolkit_INCLUDE_DIRS}")
9 |
10 | foreach(dir IN LISTS CUDAToolkit_INCLUDE_DIRS)
11 | list(APPEND STDGPU_CUDATOOLKIT_INCLUDE_DIRS "${dir}/cccl")
12 | endforeach()
13 |
14 | set(${STDGPU_OUTPUT_THRUST_PATHS} "${STDGPU_CUDATOOLKIT_INCLUDE_DIRS}")
15 | else()
16 | set(${STDGPU_OUTPUT_THRUST_PATHS} "${CUDAToolkit_INCLUDE_DIRS}")
17 | endif()
18 |
19 | # Make output variable visible
20 | set(${STDGPU_OUTPUT_THRUST_PATHS} ${${STDGPU_OUTPUT_THRUST_PATHS}} PARENT_SCOPE)
21 | endfunction()
22 |
--------------------------------------------------------------------------------
/cmake/FindCppcheck.cmake:
--------------------------------------------------------------------------------
1 |
2 | find_program(CPPCHECK_EXECUTABLE
3 | NAMES
4 | "cppcheck")
5 |
6 | if(CPPCHECK_EXECUTABLE)
7 | execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" "--version" OUTPUT_VARIABLE CPPCHECK_VERSION_TEXT)
8 | string(REGEX MATCH "^Cppcheck ([^\n]*)" CPPCHECK_VERSION_TEXT_CUT "${CPPCHECK_VERSION_TEXT}")
9 | set(CPPCHECK_VERSION "${CMAKE_MATCH_1}")
10 |
11 | unset(CPPCHECK_VERSION_TEXT_CUT)
12 | unset(CPPCHECK_VERSION_TEXT)
13 | endif()
14 |
15 | include(FindPackageHandleStandardArgs)
16 | find_package_handle_standard_args(Cppcheck
17 | REQUIRED_VARS CPPCHECK_EXECUTABLE
18 | VERSION_VAR CPPCHECK_VERSION)
19 |
20 | if(Cppcheck_FOUND)
21 | add_executable(Cppcheck::Cppcheck IMPORTED)
22 | set_target_properties(Cppcheck::Cppcheck PROPERTIES IMPORTED_LOCATION "${CPPCHECK_EXECUTABLE}")
23 | endif()
24 |
--------------------------------------------------------------------------------
/src/stdgpu/impl/iterator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
18 | #include
19 |
20 | namespace stdgpu
21 | {
22 |
23 | template <>
24 | index64_t
25 | size(void* array)
26 | {
27 | return size_bytes(array);
28 | }
29 |
30 | } // namespace stdgpu
31 |
--------------------------------------------------------------------------------
/src/stdgpu/openmp/platform_check.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_OPENMP_PLATFORM_CHECK_H
17 | #define STDGPU_OPENMP_PLATFORM_CHECK_H
18 |
19 | namespace stdgpu::openmp
20 | {
21 |
22 | // No check required
23 |
24 | } // namespace stdgpu::openmp
25 |
26 | #endif // STDGPU_OPENMP_PLATFORM_CHECK_H
27 |
--------------------------------------------------------------------------------
/cmake/FindClangTidy.cmake:
--------------------------------------------------------------------------------
1 |
2 | find_program(CLANG_TIDY_EXECUTABLE
3 | NAMES
4 | "clang-tidy")
5 |
6 | if(CLANG_TIDY_EXECUTABLE)
7 | execute_process(COMMAND "${CLANG_TIDY_EXECUTABLE}" "--version" OUTPUT_VARIABLE CLANG_TIDY_VERSION_TEXT)
8 | string(REGEX MATCH "LLVM version ([^\n]*)" CLANG_TIDY_VERSION_TEXT_CUT "${CLANG_TIDY_VERSION_TEXT}")
9 | set(CLANG_TIDY_VERSION "${CMAKE_MATCH_1}")
10 |
11 | unset(CLANG_TIDY_VERSION_TEXT_CUT)
12 | unset(CLANG_TIDY_VERSION_TEXT)
13 | endif()
14 |
15 | include(FindPackageHandleStandardArgs)
16 | find_package_handle_standard_args(ClangTidy
17 | REQUIRED_VARS CLANG_TIDY_EXECUTABLE
18 | VERSION_VAR CLANG_TIDY_VERSION)
19 |
20 | if(ClangTidy_FOUND)
21 | add_executable(ClangTidy::ClangTidy IMPORTED)
22 | set_target_properties(ClangTidy::ClangTidy PROPERTIES IMPORTED_LOCATION "${CLANG_TIDY_EXECUTABLE}")
23 | endif()
24 |
--------------------------------------------------------------------------------
/src/stdgpu/device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_DEVICE_H
17 | #define STDGPU_DEVICE_H
18 |
19 | namespace stdgpu
20 | {
21 |
22 | /**
23 | * \brief Prints the technical data of the currently used device
24 | */
25 | void
26 | print_device_information();
27 |
28 | } // namespace stdgpu
29 |
30 | #endif // STDGPU_DEVICE_H
31 |
--------------------------------------------------------------------------------
/src/stdgpu/hip/device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_HIP_DEVICE_H
17 | #define STDGPU_HIP_DEVICE_H
18 |
19 | namespace stdgpu::hip
20 | {
21 |
22 | /**
23 | * \brief Prints the technical data of the currently used device
24 | */
25 | void
26 | print_device_information();
27 |
28 | } // namespace stdgpu::hip
29 |
30 | #endif // STDGPU_HIP_DEVICE_H
31 |
--------------------------------------------------------------------------------
/src/stdgpu/cuda/device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_CUDA_DEVICE_H
17 | #define STDGPU_CUDA_DEVICE_H
18 |
19 | namespace stdgpu::cuda
20 | {
21 |
22 | /**
23 | * \brief Prints the technical data of the currently used device
24 | */
25 | void
26 | print_device_information();
27 |
28 | } // namespace stdgpu::cuda
29 |
30 | #endif // STDGPU_CUDA_DEVICE_H
31 |
--------------------------------------------------------------------------------
/docs/development/contributing/tests.md:
--------------------------------------------------------------------------------
1 | # Tests
2 |
3 | We check our code by a variety of tests which complement the pre-conditions and post-conditions used throughout the library. In case you add a new class/function or you extend or provide a fix to an existing function, we recommend and encourage you to also include a corresponding unit test in the set of the existing tests.
4 |
5 | For running the unit tests, you can use the following command/script:
6 |
7 | ::::{tab-set}
8 |
9 | :::{tab-item} Direct Command
10 | :sync: direct
11 |
12 | ```sh
13 | cmake -E chdir build ctest -V -C Release
14 | ```
15 |
16 | :::
17 |
18 | :::{tab-item} Provided Script
19 | :sync: script
20 |
21 | ```sh
22 | bash tools/run_tests.sh Release
23 | ```
24 |
25 | :::
26 |
27 | ::::
28 |
29 |
30 | :::{note}
31 | The `STDGPU_BUILD_TESTS` option must be enabled to also compile the tests, which is already the default if not manually altered, see [](../../getting_started/building_from_source.md#configuration-options).
32 | :::
33 |
--------------------------------------------------------------------------------
/src/stdgpu/impl/device.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
18 | #include
19 |
20 | #include STDGPU_DETAIL_BACKEND_HEADER(device.h)
21 |
22 | namespace stdgpu
23 | {
24 |
25 | void
26 | print_device_information()
27 | {
28 | stdgpu::STDGPU_BACKEND_NAMESPACE::print_device_information();
29 | }
30 |
31 | } // namespace stdgpu
32 |
--------------------------------------------------------------------------------
/src/stdgpu/openmp/device.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_OPENMP_DEVICE_H
17 | #define STDGPU_OPENMP_DEVICE_H
18 |
19 | namespace stdgpu::openmp
20 | {
21 |
22 | /**
23 | * \brief Prints the technical data of the currently used device
24 | */
25 | void
26 | print_device_information();
27 |
28 | } // namespace stdgpu::openmp
29 |
30 | #endif // STDGPU_OPENMP_DEVICE_H
31 |
--------------------------------------------------------------------------------
/cmake/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | # https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
2 |
3 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
4 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
5 | endif()
6 |
7 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
8 | string(REGEX REPLACE "\n" ";" files "${files}")
9 | foreach(file ${files})
10 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
11 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
12 | execute_process(
13 | COMMAND "@CMAKE_COMMAND@" "-E" "rm" "$ENV{DESTDIR}${file}"
14 | RESULT_VARIABLE rm_retval
15 | )
16 | if(NOT "${rm_retval}" STREQUAL 0)
17 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
18 | endif()
19 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
20 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
21 | endif()
22 | endforeach()
23 |
24 |
--------------------------------------------------------------------------------
/cmake/FindClangFormat.cmake:
--------------------------------------------------------------------------------
1 |
2 | find_program(CLANG_FORMAT_EXECUTABLE
3 | NAMES
4 | "clang-format-18" # Prefer exact version
5 | "clang-format")
6 |
7 | if(CLANG_FORMAT_EXECUTABLE)
8 | execute_process(COMMAND "${CLANG_FORMAT_EXECUTABLE}" "--version" OUTPUT_VARIABLE CLANG_FORMAT_VERSION_TEXT)
9 | string(REGEX MATCH "clang-format version ([^\n]*)" CLANG_FORMAT_VERSION_TEXT_CUT "${CLANG_FORMAT_VERSION_TEXT}")
10 | set(CLANG_FORMAT_VERSION "${CMAKE_MATCH_1}")
11 |
12 | unset(CLANG_FORMAT_VERSION_TEXT_CUT)
13 | unset(CLANG_FORMAT_VERSION_TEXT)
14 | endif()
15 |
16 | include(FindPackageHandleStandardArgs)
17 | find_package_handle_standard_args(ClangFormat
18 | REQUIRED_VARS CLANG_FORMAT_EXECUTABLE
19 | VERSION_VAR CLANG_FORMAT_VERSION)
20 |
21 | if(ClangFormat_FOUND)
22 | add_executable(ClangFormat::ClangFormat IMPORTED)
23 | set_target_properties(ClangFormat::ClangFormat PROPERTIES IMPORTED_LOCATION "${CLANG_FORMAT_EXECUTABLE}")
24 | endif()
25 |
--------------------------------------------------------------------------------
/tests/install_test/install_test.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
18 | int
19 | main()
20 | {
21 | const stdgpu::index_t n = 1000;
22 | const int default_value = 42;
23 |
24 | int* d_array = createDeviceArray(n, default_value);
25 | int* h_array = copyCreateDevice2HostArray(d_array, n);
26 |
27 | destroyHostArray(h_array);
28 | destroyDeviceArray(d_array);
29 | }
30 |
--------------------------------------------------------------------------------
/benchmarks/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(FetchContent)
2 |
3 | FetchContent_Declare(
4 | benchmark
5 | PREFIX benchmark
6 | URL https://github.com/google/benchmark/archive/refs/tags/v1.9.2.zip
7 | URL_HASH SHA256=a13cdcd3b0e3725e371f977a2855fecd651fc0236c67da16e325b726057b15b4
8 | DOWNLOAD_DIR "${STDGPU_EXTERNAL_DIR}/benchmark"
9 | )
10 |
11 | set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "")
12 | set(BENCHMARK_ENABLE_WERROR OFF CACHE INTERNAL "")
13 | set(BENCHMARK_ENABLE_INSTALL OFF CACHE INTERNAL "")
14 | set(BENCHMARK_ENABLE_DOXYGEN OFF CACHE INTERNAL "")
15 | set(BENCHMARK_INSTALL_DOCS OFF CACHE INTERNAL "")
16 |
17 | FetchContent_MakeAvailable(benchmark)
18 |
19 | # Suppress clang-tidy errors on benchmark by treating it as a system library
20 | # Use SYSTEM in FetchContent_Declare for CMake 3.25+ instead when it becomes available
21 | get_target_property(benchmark_INCLUDE_DIRS benchmark INTERFACE_INCLUDE_DIRECTORIES)
22 | set_target_properties(benchmark PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${benchmark_INCLUDE_DIRS}")
23 |
24 |
25 | add_subdirectory(stdgpu)
26 |
--------------------------------------------------------------------------------
/tests/test_memory_utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 |
18 | namespace test_utils
19 | {
20 |
21 | void
22 | allocator_statistics::reset()
23 | {
24 | default_constructions = 0;
25 | copy_constructions = 0;
26 | destructions = 0;
27 | }
28 |
29 | allocator_statistics&
30 | get_allocator_statistics()
31 | {
32 | static allocator_statistics stats;
33 | return stats;
34 | }
35 |
36 | } // namespace test_utils
37 |
--------------------------------------------------------------------------------
/src/stdgpu/impl/preprocessor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_PREPROCESSOR_H
17 | #define STDGPU_PREPROCESSOR_H
18 |
19 | namespace stdgpu::detail
20 | {
21 |
22 | #define STDGPU_DETAIL_CAT2_DIRECT(A, B) A##B
23 | #define STDGPU_DETAIL_CAT2(A, B) STDGPU_DETAIL_CAT2_DIRECT(A, B)
24 |
25 | #define STDGPU_DETAIL_CAT3(A, B, C) STDGPU_DETAIL_CAT2(A, STDGPU_DETAIL_CAT2(B, C))
26 |
27 | } // namespace stdgpu::detail
28 |
29 | #endif // STDGPU_PREPROCESSOR_H
30 |
--------------------------------------------------------------------------------
/benchmarks/stdgpu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(benchmarkstdgpu main.cpp)
3 |
4 | add_subdirectory(${STDGPU_BACKEND_DIRECTORY})
5 |
6 | target_include_directories(benchmarkstdgpu PRIVATE
7 | "${CMAKE_CURRENT_SOURCE_DIR}/..")
8 |
9 | target_compile_options(benchmarkstdgpu PRIVATE ${STDGPU_DEVICE_FLAGS}
10 | ${STDGPU_HOST_FLAGS}
11 | ${STDGPU_TEST_DEVICE_FLAGS}
12 | ${STDGPU_TEST_HOST_FLAGS})
13 |
14 | target_link_libraries(benchmarkstdgpu PRIVATE
15 | stdgpu::stdgpu
16 | benchmark::benchmark)
17 |
18 | set_target_properties(benchmarkstdgpu PROPERTIES CXX_CLANG_TIDY "${STDGPU_PROPERTY_CLANG_TIDY}")
19 | set_target_properties(benchmarkstdgpu PROPERTIES CXX_CPPCHECK "${STDGPU_PROPERTY_CPPCHECK}")
20 | if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
21 | set_target_properties(benchmarkstdgpu PROPERTIES COMPILE_WARNING_AS_ERROR "${STDGPU_COMPILE_WARNING_AS_ERROR}")
22 | endif()
23 |
--------------------------------------------------------------------------------
/docs/fix_html_titles/__main__.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | import difflib
4 | import html
5 | import pathlib
6 |
7 |
8 | def main() -> None:
9 | doxygen_dir = pathlib.Path(__file__).parents[1] / "doxygen"
10 |
11 | print(f'Fixing HTML titles in "{doxygen_dir}"...')
12 |
13 | counter = 0
14 | for file in sorted((pathlib.Path(__file__).parents[1] / "doxygen").glob("*rst")):
15 | with file.open("r") as f:
16 | rst_content = f.read()
17 |
18 | rst_content_unescaped = html.unescape(rst_content)
19 |
20 | if rst_content_unescaped != rst_content:
21 | counter += 1
22 | diff = difflib.unified_diff(
23 | rst_content.splitlines(keepends=True), rst_content_unescaped.splitlines(keepends=True)
24 | )
25 |
26 | print("".join(diff), end="")
27 |
28 | with file.open("w") as f:
29 | f.write(rst_content_unescaped)
30 |
31 | print(f'Fixing HTML titles in "{doxygen_dir}"... done. ({counter} files changed)')
32 |
33 |
34 | if __name__ == "__main__":
35 | main()
36 |
--------------------------------------------------------------------------------
/src/stdgpu/hip/platform_check.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_HIP_PLATFORM_CHECK_H
17 | #define STDGPU_HIP_PLATFORM_CHECK_H
18 |
19 | #include
20 |
21 | namespace stdgpu::hip
22 | {
23 |
24 | #if STDGPU_DEVICE_COMPILER != STDGPU_DEVICE_COMPILER_HIPCLANG
25 | #error STDGPU ERROR: Wrong compiler detected! You are including a file with functions that must be compiled with the device compiler!
26 | #include // Helper to stop compilation as early as possible
27 | #endif
28 |
29 | } // namespace stdgpu::hip
30 |
31 | #endif // STDGPU_HIP_PLATFORM_CHECK_H
32 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | # Input parameters:
3 | # - File name of the example without file extension
4 | # - File extension of the example
5 | macro(stdgpu_detail_add_example)
6 | set(STDGPU_EXAMPLES_NAME "${ARGV0}")
7 | add_executable(${STDGPU_EXAMPLES_NAME} "${STDGPU_EXAMPLES_NAME}.${ARGV1}")
8 | target_compile_options(${STDGPU_EXAMPLES_NAME} PRIVATE ${STDGPU_DEVICE_FLAGS}
9 | ${STDGPU_HOST_FLAGS})
10 | target_link_libraries(${STDGPU_EXAMPLES_NAME} PRIVATE stdgpu::stdgpu)
11 | set_target_properties(${STDGPU_EXAMPLES_NAME} PROPERTIES CXX_CLANG_TIDY "${STDGPU_PROPERTY_CLANG_TIDY}")
12 | set_target_properties(${STDGPU_EXAMPLES_NAME} PROPERTIES CXX_CPPCHECK "${STDGPU_PROPERTY_CPPCHECK}")
13 | if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
14 | set_target_properties(${STDGPU_EXAMPLES_NAME} PROPERTIES COMPILE_WARNING_AS_ERROR "${STDGPU_COMPILE_WARNING_AS_ERROR}")
15 | endif()
16 | endmacro()
17 |
18 | macro(stdgpu_add_example_cpp)
19 | stdgpu_detail_add_example(${ARGV0} "cpp")
20 | endmacro()
21 |
22 |
23 | stdgpu_add_example_cpp(contract)
24 | stdgpu_add_example_cpp(createAndDestroyDeviceArray)
25 | stdgpu_add_example_cpp(createAndDestroyDeviceObject)
26 |
27 | add_subdirectory(${STDGPU_BACKEND_DIRECTORY})
28 |
--------------------------------------------------------------------------------
/src/stdgpu/openmp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package(OpenMP 2.0 REQUIRED)
3 |
4 | set(STDGPU_DEPENDENCIES_BACKEND_INIT "
5 | find_dependency(OpenMP 2.0 REQUIRED)
6 | " PARENT_SCOPE)
7 |
8 | target_sources(stdgpu PRIVATE impl/device.cpp
9 | impl/memory.cpp)
10 |
11 | if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.23)
12 | target_sources(stdgpu PUBLIC FILE_SET stdgpu_backend_headers
13 | TYPE HEADERS
14 | BASE_DIRS ${STDGPU_INCLUDE_LOCAL_DIR}
15 | FILES atomic.h
16 | device.h
17 | memory.h
18 | platform.h
19 | platform_check.h)
20 |
21 | target_sources(stdgpu PUBLIC FILE_SET stdgpu_backend_header_implementations
22 | TYPE HEADERS
23 | BASE_DIRS ${STDGPU_INCLUDE_LOCAL_DIR}
24 | FILES impl/atomic_detail.h
25 | impl/memory_detail.h)
26 | endif()
27 |
28 | target_compile_definitions(stdgpu PUBLIC THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP)
29 |
30 | target_link_libraries(stdgpu PUBLIC OpenMP::OpenMP_CXX)
31 |
--------------------------------------------------------------------------------
/src/stdgpu/cuda/platform_check.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_CUDA_PLATFORM_CHECK_H
17 | #define STDGPU_CUDA_PLATFORM_CHECK_H
18 |
19 | #include
20 |
21 | namespace stdgpu::cuda
22 | {
23 |
24 | #if STDGPU_DEVICE_COMPILER != STDGPU_DEVICE_COMPILER_NVCC && STDGPU_DEVICE_COMPILER != STDGPU_DEVICE_COMPILER_CUDACLANG
25 | #error STDGPU ERROR: Wrong compiler detected! You are including a file with functions that must be compiled with the device compiler!
26 | #include // Helper to stop compilation as early as possible
27 | #endif
28 |
29 | } // namespace stdgpu::cuda
30 |
31 | #endif // STDGPU_CUDA_PLATFORM_CHECK_H
32 |
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | ---
2 | Checks: "-*,\
3 | bugprone-*,\
4 | -bugprone-easily-swappable-parameters,\
5 | cert-*,\
6 | -cert-dcl21-cpp,\
7 | -cert-err58-cpp,\
8 | concurrency-*,\
9 | cppcoreguidelines-*,\
10 | -cppcoreguidelines-avoid-c-arrays,\
11 | -cppcoreguidelines-avoid-non-const-global-variables,\
12 | -cppcoreguidelines-macro-usage,\
13 | -cppcoreguidelines-missing-std-forward,\
14 | -cppcoreguidelines-owning-memory,\
15 | -cppcoreguidelines-pro-bounds-pointer-arithmetic,\
16 | -cppcoreguidelines-pro-type-const-cast,\
17 | -cppcoreguidelines-pro-type-vararg,\
18 | -cppcoreguidelines-rvalue-reference-param-not-moved,\
19 | hicpp-*,\
20 | -hicpp-avoid-c-arrays,\
21 | -hicpp-vararg,\
22 | -hicpp-use-auto,\
23 | misc-*,\
24 | -misc-const-correctness,\
25 | -misc-include-cleaner,\
26 | -misc-use-internal-linkage,\
27 | modernize-*,\
28 | -modernize-avoid-c-arrays,\
29 | -modernize-use-auto,\
30 | -modernize-use-nodiscard,\
31 | -modernize-use-trailing-return-type,\
32 | performance-*,\
33 | -performance-avoid-endl,\
34 | portability-*,\
35 | readability-*,\
36 | -readability-avoid-const-params-in-decls,\
37 | -readability-const-return-type,\
38 | -readability-function-cognitive-complexity,\
39 | -readability-identifier-length,\
40 | -readability-redundant-casting,\
41 | -readability-redundant-member-init,\
42 | "
43 | HeaderFilterRegex: 'src|benchmark/stdgpu|test/stdgpu'
44 | ...
45 |
--------------------------------------------------------------------------------
/cmake/hip/Findthrust.cmake:
--------------------------------------------------------------------------------
1 | find_package(rocthrust)
2 |
3 | if(rocthrust_INCLUDE_DIR)
4 | file(STRINGS "${rocthrust_INCLUDE_DIR}/thrust/version.h"
5 | THRUST_VERSION_STRING
6 | REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)")
7 |
8 | string(REGEX REPLACE "#define THRUST_VERSION[ \t]+([0-9]+).*" "\\1" THRUST_VERSION_STRING ${THRUST_VERSION_STRING})
9 |
10 | math(EXPR THRUST_VERSION_MAJOR "${THRUST_VERSION_STRING} / 100000")
11 | math(EXPR THRUST_VERSION_MINOR "(${THRUST_VERSION_STRING} / 100) % 1000")
12 | math(EXPR THRUST_VERSION_PATCH "${THRUST_VERSION_STRING} % 100")
13 | unset(THRUST_VERSION_STRING)
14 |
15 | set(THRUST_VERSION "${THRUST_VERSION_MAJOR}.${THRUST_VERSION_MINOR}.${THRUST_VERSION_PATCH}")
16 | endif()
17 |
18 | include(FindPackageHandleStandardArgs)
19 | find_package_handle_standard_args(thrust
20 | REQUIRED_VARS rocthrust_INCLUDE_DIR
21 | VERSION_VAR THRUST_VERSION)
22 |
23 | if(thrust_FOUND)
24 | add_library(thrust::thrust INTERFACE IMPORTED)
25 | target_link_libraries(thrust::thrust INTERFACE roc::rocthrust)
26 |
27 | mark_as_advanced(THRUST_INCLUDE_DIR
28 | THRUST_VERSION
29 | THRUST_VERSION_MAJOR
30 | THRUST_VERSION_MINOR
31 | THRUST_VERSION_PATCH)
32 | endif()
33 |
--------------------------------------------------------------------------------
/examples/contract.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 | #include
18 |
19 | #include // STDGPU_EXPECTS, STDGPU_ENSURES
20 |
21 | float
22 | safe_sqrt(const float x)
23 | {
24 | STDGPU_EXPECTS(x >= 0.0F);
25 |
26 | // cppcheck-suppress invalidFunctionArg
27 | float result = std::sqrt(x);
28 |
29 | STDGPU_ENSURES(result >= 0.0F);
30 | return result;
31 | }
32 |
33 | int
34 | main()
35 | {
36 | std::cout << "In debug mode, a pre-condition failure will be printed right after this line." << std::endl
37 | << std::endl;
38 |
39 | float sqrt_m1 = safe_sqrt(-1.0F);
40 |
41 | std::cout << std::endl
42 | << "This line is only visible when the contracts are deactivated (release mode) : safe_sqrt(-1.0f) = "
43 | << sqrt_m1 << std::endl;
44 | }
45 |
--------------------------------------------------------------------------------
/src/stdgpu/type_traits.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Patrick Stotko
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #ifndef STDGPU_TYPE_TRAITS_H
17 | #define STDGPU_TYPE_TRAITS_H
18 |
19 | /**
20 | * \defgroup type_traits type_traits
21 | * \ingroup utilities
22 | */
23 |
24 | /**
25 | * \file stdgpu/type_traits.h
26 | */
27 |
28 | #include
29 |
30 | namespace stdgpu
31 | {
32 |
33 | /**
34 | * \ingroup type_traits
35 | * \brief Type trait to remove const, volative, and reference qualifiers from the given type
36 | * \tparam T The input type
37 | */
38 | template
39 | struct remove_cvref
40 | {
41 | using type = std::remove_cv_t>; /**< type */
42 | };
43 |
44 | //! @cond Doxygen_Suppress
45 | template
46 | using remove_cvref_t = typename remove_cvref::type;
47 | //! @endcond
48 |
49 | } // namespace stdgpu
50 |
51 | #include
52 |
53 | #endif // STDGPU_TYPE_TRAITS_H
54 |
--------------------------------------------------------------------------------
/docs/_static/stdgpu_custom_sphinx.css:
--------------------------------------------------------------------------------
1 | /* Remove pointless scrollbar in sidebar when the content fits into the page */
2 | div#rtd-footer-container {
3 | display: none;
4 | }
5 |
6 |
7 | /* Remove empty footer inherited from pydata theme */
8 | footer.bd-footer {
9 | display: none;
10 | }
11 |
12 |
13 | /* Better aligned colors for dark mode (similar contrast to light mode) */
14 | html[data-theme="dark"] {
15 | --pst-color-border: #3a3a3a;
16 | }
17 |
18 |
19 | /* Use sphinx-book-theme separator color */
20 | footer.bd-footer-content {
21 | border-top: 1px solid var(--pst-color-border);
22 | }
23 |
24 | .table {
25 | --bs-table-border-color: var(--pst-color-border);
26 | }
27 |
28 |
29 | /* Use sphinx-book-theme separator color in sphinx-design */
30 | :root {
31 | --sd-color-tabs-overline: var(--pst-color-border) !important;
32 | --sd-color-tabs-underline: var(--pst-color-border) !important;
33 | }
34 |
35 |
36 | /* Approximately replicated (somehow) broken style of tabs in sphinx-design */
37 | .sd-tab-set,
38 | .sd-tab-content,
39 | .sd-tab-set > label {
40 | background-color: var(--pst-color-background) !important;
41 | }
42 |
43 | .bd-content .sd-tab-set .sd-tab-content,
44 | .bd-content .sd-tab-set > input:checked + label {
45 | border: 0;
46 | }
47 |
48 | .sd-tab-content {
49 | padding: 0 !important;
50 | padding-bottom: .75rem !important;
51 | padding-top: .75rem !important;
52 | }
53 |
54 | .bd-content .sd-tab-set > input:checked + label {
55 | border-bottom: 0.125rem solid var(--pst-color-primary);
56 | }
57 |
--------------------------------------------------------------------------------
/src/stdgpu/cuda/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | find_package(CUDAToolkit 11.5 REQUIRED MODULE)
3 |
4 | set(STDGPU_DEPENDENCIES_BACKEND_INIT "
5 | find_dependency(CUDAToolkit 11.5 REQUIRED MODULE)
6 | " PARENT_SCOPE)
7 |
8 | target_sources(stdgpu PRIVATE impl/device.cpp
9 | impl/memory.cpp)
10 |
11 | if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.23)
12 | target_sources(stdgpu PUBLIC FILE_SET stdgpu_backend_headers
13 | TYPE HEADERS
14 | BASE_DIRS ${STDGPU_INCLUDE_LOCAL_DIR}
15 | FILES atomic.cuh
16 | device.h
17 | memory.h
18 | platform.h
19 | platform_check.h)
20 |
21 | target_sources(stdgpu PUBLIC FILE_SET stdgpu_backend_header_implementations
22 | TYPE HEADERS
23 | BASE_DIRS ${STDGPU_INCLUDE_LOCAL_DIR}
24 | FILES impl/atomic_detail.cuh
25 | impl/error.h
26 | impl/memory_detail.h)
27 | endif()
28 |
29 | target_compile_features(stdgpu PUBLIC cuda_std_17)
30 |
31 | target_compile_definitions(stdgpu PUBLIC THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA)
32 |
33 | if(STDGPU_BUILD_SHARED_LIBS)
34 | target_link_libraries(stdgpu PUBLIC CUDA::cudart)
35 | else()
36 | target_link_libraries(stdgpu PUBLIC CUDA::cudart_static)
37 | endif()
38 |
--------------------------------------------------------------------------------
/docs/development/contributing/documentation.md:
--------------------------------------------------------------------------------
1 | # Documentation
2 |
3 | We use [**Doxygen**](https://www.doxygen.org/index.html) for generating the C++ documentation and [**Sphinx**](https://www.sphinx-doc.org/) for the remaining parts. Thus, if you would like to contribute here, we recommend to do a local build of the documentation on your computer and to see how your changes will look like in the end.
4 |
5 | For building, the following tools along with their versions are required:
6 |
7 | - Doxygen **1.9.6**, which will be automatically built from source if that *exact* version is not found on your system (requires [Bison and Flex utilites](https://www.doxygen.nl/manual/install.html))
8 | - Sphinx including some extensions, which can all be installed by
9 | ```sh
10 | pip install -r docs/requirements.txt
11 | ```
12 |
13 | When these documenation dependencies are installed, you can build the documentation using the following command/script:
14 |
15 |
16 | ::::{tab-set}
17 |
18 | :::{tab-item} Direct Command
19 | :sync: direct
20 |
21 | ```sh
22 | cmake --build build --target stdgpu_doc --parallel 8
23 | ```
24 |
25 | :::
26 |
27 | :::{tab-item} Provided Script
28 | :sync: script
29 |
30 | ```sh
31 | bash tools/dev/build_documentation.sh
32 | ```
33 |
34 | :::
35 |
36 | ::::
37 |
38 |
39 | :::{note}
40 | The `STDGPU_BUILD_DOCUMENTATION` option must be enabled for this purpose, e.g. via `-D